Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Get value function ??? Alloy

$
0
0

I have a problem with Alloy would help everyone : I have a three window register.js, index.js, data.js and one Model User.js

In file register.js: I register user info and click button save user info will save into data.js

function save(){
    var username = $.tfUsername.value;
    var pass = $.tfPass.value;
    var newUser = Alloy.createController('data');
    newUser.addUser(username,pass);
 
}
In file data.js :
var lstUser= [];
function addUser(username, password){
    var newUser = Alloy.createModel('User', {
        username:username,
        pass: password
    });
    lstUser.push(newUser);
}
 
function getLstUser(){
    return lstUser;
}

in file index.js:

var user = Alloy.createController('data');
var lstUser = user.getLstUser();
aler(lstUsr.length);
When i call function getLstUser , value aler show value = 0 ??

please help me ! Thanks


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>