angular.js - What does angular ui-router "deferIntercept" do and how should it be applied?
为情所困
为情所困 2017-05-15 17:04:31
0
1
597

"deferIntercept"

I feel that this thing is helpful to me, but the documentation is not very thorough.

Do you have a simpler introduction or demo? Thank you

为情所困
为情所困

reply all(1)
黄舟

The following is the normal writing method. . .

App.config(function ($stateProvider, $urlRouterProvider) {
    // $urlRouterProvider.deferIntercept();

    $urlRouterProvider.otherwise('/view/index');
    $stateProvider
            .state('Home', {
                url: '/view/index',
                templateUrl: 'view/index.html'
            })
            .state('Error', {
                url: '/view/error',
                templateUrl: 'view/error.html'
            })
});

If you add $urlRouterProvider.deferIntercept(), both the default route and the redirected route will be disabled. This is why the official website says to prevent URL jumps~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template