当前位置: 移动技术网 > IT编程>脚本编程>AngularJs > AngularJS 打开新的标签页实现代码

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

2017年12月12日  | 移动技术网IT编程  | 我要评论

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

 <!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> 

总结

以上所述是小编给大家介绍的angularjs 打开新的标签页实现代码,希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网