Source language: Translate to:

Accesing Variables and Subroutines from Plugin

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Accesing Variables and Subroutines from Plugin

Postby luishp » Sat Jan 30, 2016 2:00 am

I have been trying many ways to access variables and subroutines from my javascript plugins with not success.
If I try $rootScope.myvar, then I get:
Code: Select all
ReferenceError: $rootScope is not defined

Am I missing something important about how NAB or AngularJS are working here?
Thank you!
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: Accesing Variables and Subroutines from Plugin

Postby Neosoft Support » Sun Jan 31, 2016 4:39 pm

Try this:

window.$rootScope.myvar
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Accesing Variables and Subroutines from Plugin

Postby anton » Tue Feb 02, 2016 1:57 am

Neosoft Support wrote:Try this:
window.$rootScope.myvar


does not work

Code: Select all
TypeError: Не удалось задать свойство "myvar" ссылки, значение которой не определено или является NULL
   at bakTouchSwipStatus (file:///D:/xampp/htdocs/bakMySQLPHP/test_Test/main.js?v=53:31:382)
   at $scope.PushButton1_click (file:///D:/xampp/htdocs/bakMySQLPHP/test_Test/main.js?v=53:23:1)
   at Anonymous function (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/angular.min.js:200:52)
   at Anonymous function (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/angular-touch.min.js:12:172)
   at m.prototype.$eval (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/angular.min.js:126:239)
   at m.prototype.$apply (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/angular.min.js:126:452)
   at Anonymous function (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/angular-touch.min.js:12:152)
   at m.event.dispatch (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/jquery.min.js:4:8493)
   at r.handle (file:///C:/ProgramData/NeoSoft/NeoAppBuilder/js/jquery.min.js:4:5177)



in the program NeoAppBuilder of action takes place in advance:
Code: Select all
SetVar [myvar] ""
User avatar
anton
 
Posts: 51
Joined: Fri Oct 19, 2012 9:21 pm

Re: Accesing Variables and Subroutines from Plugin

Postby luishp » Tue Feb 02, 2016 5:41 am

I have been trying almost any combination I can think in, with no results.
As Anton says, window.$rootScope.myvar does not seem to work.
No way to read or write a value stored in a NAB variable from plugins.
In the other hand, I can call any function on my plugins from NAB BeginJS action, but not the opposite, even if I define the function inside a BeginJS.
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: Accesing Variables and Subroutines from Plugin

Postby anton » Tue Feb 02, 2016 6:31 am

luishp wrote:I have been trying almost any combination I can think in, with no results.
As Anton says, window.$rootScope.myvar does not seem to work.
No way to read or write a value stored in a NAB variable from plugins.
In the other hand, I can call any function on my plugins from NAB BeginJS action, but not the opposite, even if I define the function inside a BeginJS.


luishp - с тебя магарыч, я нашел рабочий вариант!!!! Ура!!!! З часа чтения доков по AngularJs и алилуя!!!

Three hours reading documentation AngularJS and I found a solution to this problem !!! Hooray!!!!

Code: Select all
angular.element(document).ready(function(){
$App.myvar = "MyVar";
$App.$digest();
});
User avatar
anton
 
Posts: 51
Joined: Fri Oct 19, 2012 9:21 pm

Re: Accesing Variables and Subroutines from Plugin

Postby luishp » Tue Feb 02, 2016 6:34 am

Anton, congratulations! And thank you!!! :)
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest