时间: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>
总结