-
-
Save olivoil/2864686 to your computer and use it in GitHub Desktop.
ember.js login form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = Ember.Application.create({}); | |
App.loginController = Ember.Object.create({ | |
// do login stuff | |
}); | |
App.LoginFormView = Ember.View.extend({ | |
login: null, | |
password: null, | |
submitLogin: function() { | |
var login = this.get('login'); | |
var password = this.get('password'); | |
console.log('Login: ' + login + ' Password: ' + password); | |
// do some login stuff | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="jquery-1.7.1.min.js"></script> | |
<script src="ember.js"></script> | |
<script src="app.js"></script> | |
</head> | |
<body> | |
<div id="app"> | |
<script type="text/x-handlebars"> | |
{{#view App.LoginFormView tagName="form"}} | |
<label>Login: {{view Ember.TextField valueBinding="login"}} </label> | |
<label>Pasword: {{view Ember.TextField type="password" valueBinding="password"}} </label> | |
{{#view Ember.Button target="parentView" action="submitLogin"}}Login{{/view}} | |
{{/view}} | |
</script> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment