While I was building my app at the end I wanted to test all of my functionality but the main one stopped working...
My login form seems to not be able to get the user information from the form.
My login template :
<script type="text/x-handlebars" data-template-name="login">
<form {{action "login" on=submit}}>
<div>
<div>
<label>Domain</label>
</div>
<div>
{{input type="text" value=domain placeholder="Domain"}}
</div>
</div>
<div>
<div>
<label>Username</label>
</div>
<div>
{{input value=username type="text" placeholder="Username"}}
</div>
</div>
<div>
<div>
<label>Password</label>
</div>
<div>
{{input value=password type="password" placeholder="Password"}}
</div>
</div>
<button type="submit" {{bind-attr disabled="isProcessing"}}>Log in</button>
</form>
</script>
And my loginController:
App.LoginController = Ember.ObjectController.extend({
actions: {
login: function() {
var data = this.getProperties("domain", "username", "password");
console.log(data);
}
}
});
My action 'login' is triggered but I have those error that I can't explain :
Assertion failed: Cannot delegate set('domain', g) to the 'content' property of object proxy <App.LoginController:ember330>: its 'content' is undefined.
Uncaught Error: Property set failed: object in path "domain" could not be found or was destroyed.
It was working at the beginning and I must say that I have no clue about what kind of problem is that.
[edit] This is my LoginController & my map :
App.Router.map(function() {
this.route('login', { path: '/' });
this.route('home');
});
App.LoginController = Ember.ObjectController.extend({
loginFailed: false,
isProcessing: false,
isSlowConnection: false,
timeout: null,
actions: {
isSession: function(transition) {
var session = this;
Ember.$
.get(host + '/session', function(data) {
console.log('DEBUG: Session OK');
var log = data.user;
session.store.push('login', log);
})
.fail(function() {
console.log('DEBUG: Session FAIL');
transition.abort();
session.transitionToRoute('login');
});
},
login: function() {
this.setProperties({
loginFailed: false,
isProcessing: true
});
this.set("timeout", setTimeout(this.slowConnection.bind(this), 1));
var data = this.getProperties("domain", "username", "password");
console.log(data);
this.getLoginInfo(data);
}
},
slowConnection: function() {
this.set('isSlowConnection', true);
},
reset: function() {
clearTimeout(this.get("timeout"));
this.setProperties({
loginFailed: false,
isSlowConnection: false,
isProcessing: false
});
},
getLoginInfo: function(data) {
var login = this;
Ember.$
.post(host + '/login', data, function(data) {
console.log('DEBUG: Login OK');
login.reset();
var test = data.session.user;
login.store.push('login', test);
login.transitionToRoute('home');
})
.fail(function() {
login.reset();
login.set('loginFailed', true);
console.log('DEBUG: Login Failed')
});
}
});
I'm using the isSession function in every beforeModel for my other pages to verify if the session is still available and, if so, to push the login data back in the store to save it again.
contentproperty of anObjectControllerisnull. Is there somewhere else in your code in which yousetthat controller's content? - sheldonbaker