This is my code. I want to change this code for NgComponent and delete 
uirooter :
(function () {
    'use strict';
 
    angular
        .module('app', ['ui.router', 'ngMessages', 'ngStorage', 'ngMockE2E'
])
        .config(config)
        .run(run);
 
    function config($stateProvider, $urlRouterProvider) {
        // default route
        $urlRouterProvider.otherwise("/");
 
        // app routes
        $stateProvider

            .state( 'home ', {
                url: ' / ',
                templateUrl: 'home/index.view.html ',
                controller: 'Home.IndexController ',
                controllerAs: 'vm '
            })

            .state('login ', {
                url: '/login ',
                templateUrl: 'login/index.view.html ',
                controller: 'Login.IndexController ',
                controllerAs: 'vm '
            });
    }
 
    function run($rootScope, $http, $location, $localStorage) {
        // keep user logged in after page refresh
        if ($localStorage.currentUser) {
            $http.defaults.headers.common.Authorization = 'Bearer ' + 
$localStorage.currentUser.token;
        }
 
        // redirect to login page if not logged in and trying to access a 
restricted page
        $rootScope.$on('$locationChangeStart', function (event, next, 
current) {
            var publicPages = ['/login'];
            var restrictedPage = publicPages.indexOf($location.path()) === 
-1;
            if (restrictedPage && !$localStorage.currentUser) {
                $location.path('/login');
            }
        });
    }
})();


Le mercredi 27 avril 2016 11:05:40 UTC+2, coco a écrit :
>
> Hello, 
>
> I have to make a login in AngularJS 1.5 with JWT preference. I want to 
> know how to create it?
>
> Do ngComponent contains statprovider the rooter as ui?
>
> Thank you :)
>

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to