yes that's exactly that !! Thank you very much Justin for your help !
Le mardi 18 mars 2014 16:38:25 UTC+1, Justin Walsh a écrit : > > Hi Kevin, > > I assume you want the 'Auth' service to return a promise which is > resolved/rejected. This promise is then handled in your 'MainCtrl'. > > In your case, the 'Auth' service uses the $http service (GET) to fetch the > file login.json. This promise will *ALWAYS* resolve successfully. > That's why you are always getting a successful response. > > So, I've modified the plunkr > <http://plnkr.co/edit/zVKSoxvikZdK6RihgGCa?p=preview>slightly: > > - The Auth service returns a promise > - This promise is resolved if the login and password passed in matches > the name in the file fetched using the $http service > - Otherwise the promise is rejected and a message is put on the scope > (not the root scope) > > http://plnkr.co/edit/zVKSoxvikZdK6RihgGCa?p=preview > > > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
