当前位置:主页 > 网页前端 > AngularJS >

AngularJS 打开新的标签页实现代码

时间:2021-01-02 15:11:32 | 栏目:AngularJS | 点击:

废话不多说了,直接给大家贴代码了,具体代码如下所示:

 <!DOCTYPE html> 
<html ng-app="myPro"> 
  <head> 
    <meta charset="UTF-8"> 
    <title>angularJS-打开新的标签页</title> 
    <script type="text/javascript" src="js/angular.min.js" ></script> 
    <script type="text/javascript" src="js/jquery-1.11.0.js" ></script> 
  </head> 
  <body ng-controller="myProController"> 
    <button ng-click="click_this()">打开新的标签页</button> 
  </body> 
  <script> 
    var pro = angular.module("myPro",[]); 
    pro.controller("myProController",["$scope","$location",function($scope,$location){ 
      $scope.click_this = function(){ 
        var url = $location.absUrl().split("angularJS_")[0]+'angularJS_newTab.html'; 
        window.open(url,"_blank"); 
      }; 
    }]); 
  </script> 
</html> 

总结

您可能感兴趣的文章:

相关文章