废话不多说了,直接给大家贴代码了,具体代码如下所示:
<!DOCTYPE html> <html ng-app="myPro"> <head> <meta charset="UTF-8"> <title>angularJS-打开新的标签页</title> <script type="text/javascript" src="https://www.jb51.net/js/angular.min.js" ></script> <script type="text/javascript" src="https://www.jb51.net/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 打开新的标签页实现代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章: