ember.js - Error while using simple login in ember? -


i newbie ember , part of learning trying set login form 1 tutorial doesnot seem working. error: invalid path---thats error getting in login method

i want see if password okay connect login template else kick user '/'.?

html file

<script type="text/x-handlebars" data-template-name="login">         {{message}} <br>         e-mail {{view ember.textfield target="controller" valuebinding= controller.email}} <br />         password {{view ember.textfield target="controller" valuebinding= controller.password}} <br />         <button {{action login}}>login</button>     </script>      <script type="text/x-handlebars" data-template-name="loggedin">         welcome our site !     </script> 

js file

 app.logincontroller = ember.objectcontroller.extend({ email :null, password :null, message :null,  login : function() {     var logincreds = this.getproperties('email','password');     if (logincreds.password === 'admin') {         this.set('isauthenticated',true);         console.log(isauthenticated);         this.get('target').send('isauthenticated');      }     else{         this.set('message','invalid password');         this.set('isauthenticated',false);         console.log(isauthenticated);         this.get('target').send('isauthenticated');      }  }     });      app.loginroute = ember.route.extend({ isauthenticated : function(router) {     router.transitionto('loggedin'); }, connectoutlets: function(router) {     if (!router.get('logincontroller.isauthenticated')) {         router.transitionto('/');     }     router.get('logincontroller').connectoutlet('loggedin');     },     }); 

i think problem may u didnt map path u giving in browser.you should map path this

app.router.map(function () {     this.route('login'); }); 

then in url u can add #login


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -