Ember - Bind fail when going into login mode
When I first go to my url, the inputs are correctly bound to the properties of my controller.
Then logout and what it does is go to the login page.
When I try to login again it fails because the input values ββarent bound to the controller, additionally I get this error:
Uncaught Error: Assertion Failed: Attempted to register a view with an id already in use: login
If I refresh the page it works.
Some of my codes for links:
LoginRoute
export
default Ember.Route.extend({
setupController: function(controller) {
controller.reset();
},
beforeModel: function() {
if (!Ember.isEmpty(this.controllerFor('sessions.login').get('token'))) {
this.transitionTo('promotions');
}
}
});
LogoutRoute
export
default Ember.Route.extend({
beforeModel: function() {
this.controllerFor('sessions.login').reset();
this.transitionTo('sessions.login');
}
});
LoginAction on Controller
loginUser: function() {
var _this = this;
var login = this.get("login");
var pass = this.get("password");
Login form
<form role="form" {{action 'loginUser' on='submit'}}>
<div class="form-group">
{{input type="text" class="form-control" id="login" placeholder="Login" value=login autofocus="autofocus"}}
{{input type="password" class="form-control" id="password" placeholder="Password" value=password}}
</div>
<div class="form-group">
<span class="input-group-btn">
<button class="btn btn-default" type="submit" ><span>Entrar</span></button>
</span>
</div>
</form>
After testing a few more, I saw that the textFields are duplicated when I go to this page.
I really can't figure out why
+3
Dimitri couto lameri
source
to share
No one has answered this question yet
Check out similar questions:
3
1
1
1
1
1
0
0
0
-3