Open a new tab on button click in AngularJS

后端 未结 4 836
星月不相逢
星月不相逢 2020-12-02 15:06


openTab = function () {
  $http.post(\'www.google.com\');
}
         


        
4条回答
  •  眼角桃花
    2020-12-02 15:43

    Proper HTML way: just surround your button with anchor element and add attribute target="_blank". It is as simple as that:

    
        

    Open me in new Tab

    where you can set in the controller:

    $scope.yourDynamicURL = 'https://stackoverflow.com';
    

提交回复
热议问题