Hey guys.
So i am using express.js GET request to see if i am logged in, but i'm not
quite sure how to handle it withing the angular side.
I know i'll need a controller to present data i will get from the log
session, but i am not quite sure where i should 'Get' the information from,
i understood the controller should be used only for displaying data.
What i understood is i should use a factory, and this is what i've got till
now,
angular.module('application')
>
> .controller('CheckLoginController',function($scope,CheckLoggedIn) {
>
> var promise = CheckLoggedIn.getlogged();
>
> promise.then(
>
> function(data){
>
> $scope.logged = data.error;
>
> $scope.username = data.username;
>
> }
>
> )
>
>
>
> })
>
>
>> .factory('CheckLoggedIn', function($http) {
>
> return{
>
> getlogged: function(){
>
> return $http.get('/api/user/loggedin');
>
> }
>
> }
>
> });
>
> Now what should i do, I am not quite sure.
Thanks for the help!
--
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.