Search

Friday, May 13, 2016
0 comments

Open New Browser Tab using AngularJS

2:16 AMFriday, May 13, 2016
In this article, I will show you, How to open new browser tab using ng-click event. This is the same thing in JQuery. In this example, first of all access division tag using angular,module function. In this we have ng-app as parameter. Lets see the example.

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
   <script type="text/javascript">
       var app = angular.module('FirstApp', [])
       app.controller('ControllerPage', function ($scope, $window) {
           $scope.NewTab = function () {
               $window.open("https://dotprogramming.blogspot.com");
           }
       });
    </script>
    <div ng-app="FirstApp" ng-controller="ControllerPage">
        <input type="button" value="New Tab" ng-click="NewTab()" />
    </div>
</body>
</html>
Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top