jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › AngularJS › How to get $scope inside a
This topic contains 8 replies, has 2 voices, and was last updated by Kavyad23 10 years, 8 months ago.
-
Author
-
<!DOCTYPE html> <html ng-app="App" lang="en"> <head> <meta charset="ISO-8859-1"> <link rel="stylesheet" href="../CSS/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="../CSS/Style.css" type="text/css" /> <script src="../CommonFiles/import.js"></script> <script type="text/javascript"> var App = angular.module("App", [ "jqwidgets" ]); App.controller("Controller", function($scope) { $scope.menuSettings = { width : '100%', height : '32px', autoSizeMainItems : true } $scope.ChangeWatchType = function() { alert("watchType"); } }); </script> </head> <body style="background: #EEE;"> <div ng-controller="Controller"> <jqx-docking jqx-mode="'default'" id="docking" style="float: left;" jqx-settings="dockSettings"> <div> <div class="window"> <div>Title <jqx-menu jqx-settings="menuSettings" style="visibility: visible; width: 12px !important; height: 15px !important; background: transparent !important; border: none !important;"> <ul id="WatchType"> <li><a href="#" ng-click="ChangeWatchType()">Advanced</a></li> <li><a href="#" ng-click="ChangeWatchType()">Ladder</a></li> </ul> </jqx-menu> </div> <div> Contents </div> </div> </div> </jqx-docking> </div> </body> </html>
Here I want to call, “ChangeWatchType()” function in tag. But scope is not getting inside docking window. how to get that globally.?
Here I want to call, “ChangeWatchType()” function in anchor tag. But $scope is not getting inside docking window. how to get that globally.?
Hi Kavyad23,
For handling clicks in jqxMenu items, you can use its “itemclick” event.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Please provide the samples in angularjs. I am completly implementing in Angularjs. and also $scope variables not printing inside jqxDocking. How to solve this.
$scope.$on('itemclick', function() { alert($(event.target).text()); })
Is this correct for JqxMenu Itemclick in angularjs?
Hi Kavyad23,
Yes, the menu’s event is called “itemclick”. However, in your code “event” seems to be undefined.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comBut Now also Its not working,
<!DOCTYPE html> <html ng-app="ForexOrderBookApp" lang="en"> <head> <meta charset="ISO-8859-1"> <title>Intellect GoTx FX Portal</title> <link rel="stylesheet" href="../CSS/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="../CSS/Style.css" type="text/css" /> <script src="../CommonFiles/import.js"></script> <script type="text/javascript"> var ForexOrderBookApp = angular .module("ForexOrderBookApp", [ "jqwidgets" ]); ForexOrderBookApp.controller("ForexOrderBookController", function($scope) { $scope.$on('jqxMenuCreated', function() { $scope.menuSettings.apply('minimize'); }); $scope.menuSettings = { width : '100%', height : '32px', autoSizeMainItems : true } $scope.$on('itemclick', function(event) { alert($(event.target).text()); }) }); </script> </head> <body style="background: #EEE;"> <div ng-controller="ForexOrderBookController"> <div class="minimizedBtn" style="float: left; margin: 0; padding: 0; margin-left: 100px;"> <jqx-menu jqx-settings="menuSettings" style="visibility: visible; width: 12px !important; height: 15px !important; background: transparent !important; border: none !important;"> <ul id="WatchType"> <li><a href="#">Advanced</a></li> <li><a href="#">Ladder</a></li> </ul> </jqx-menu> </div> </body> </html>
Hi Kavyad23,
You did not bind to that event. Did you learn from the documentation how to bind to events?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi peter,
I got the solution. Thank you. Now I learned “How to bin events”.
Thank you.
-
AuthorPosts
You must be logged in to reply to this topic.