Open window onclick of button

113 views
Skip to first unread message

Karthik Reddy

unread,
Jun 22, 2016, 5:13:51 AM6/22/16
to AngularJS
Hi Experts,

I am trying to show a pop up window once i click on a button.But I am getting nothing.

Here is what i Itried 

<script type="text/javascript">
       var app = angular.module('MyApp', [])
       app.controller('MyController', function ($scope, $window) {
           $scope.OpenPopupWindow = function () {
               $window.open("http://www.aspsnippets.com/", "popup", "width=300,height=200,left=10,top=150");
           }
       });
</script>
    <div ng-app="MyApp" ng-controller="MyController">
        <input type="button" value="Open Popup Window" ng-click="OpenPopupWindow()" />
    </div>

I am getting nothing

Can anyone please help me with this.

Thanks,
Karthik

Sander Elias

unread,
Jun 22, 2016, 10:15:11 AM6/22/16
to AngularJS
Hi Karthik,

Its better to add a plunk to those kind of questions.
Your function seems to work OK for me tough. See this plunk

Regards
Sander

Karthik Reddy

unread,
Jun 23, 2016, 12:02:20 AM6/23/16
to ang...@googlegroups.com
Thank you, 
Sander Elias 

Now its working

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Zb47FlRIVKE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages