-->

Friday, May 13, 2016

Open New Browser Tab using AngularJS

Open New Browser Tab using AngularJS

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>

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved