webMethods Business Console Documentation 10.5 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Programming Gadgets | Defining Angular $scope Object
 
Defining Angular $scope Object
Each controller for the gadget is injected with AngularJS $scope object in the init function and then passed over to other functions such as defineScope and defineListeners. For functions that are defined on the scope, for example, $scope.functionName=function(){}, the scope object is accessible within the function using this operator in JavaScript. However, the value of this changes dynamically depends on how the function is invoked.
To get an instance of the $scope effectively inside a scope function, the $scope object needs to be assigned to this operator, and then the object can be used throughout the function.
this.$scope.restInvocation = function(gadgetConfig){
var $scope = this;
//depending on how the restInvocation function is invoked,
//'this' object inside the function will have an instance of the $scope object

....
}

Copyright © 2014-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.