i have a problem with angular dart. 1 html file to trigger scopes and 2 controller classes index.html
... {{subCtrl.user.name}} ...
first controller
@Controller(
selector: '[mainController]',
publishAs: 'mainCtrl'
)
class MainController{
User user = new User('testuser');
MainController();
}
second controller
@Controller(
selector: '[subController]',
publishAs: 'subCtrl'
)
class SubController{
@NgOneWay('user')
User user;
// constructor
SubController(){
getData();
}
void getData(){
if(user != null){
// following code is not exececutet, because user is null
httpRequst(...);
}
}
}
when is the time user is set over @NgOneWay? seems like not before the constructor is finished. where do i have to call my method?
now i have the problem i have to make a asynch request in the getData function in the SubController class. this http request needs i.e the user.name propertie to build the domain, but user is not active when i start it in the constructor. i cant set the authentification to the second controller. there must be another option to get this working.
i tried several things with dart's future, but did not get i working for a propertie.