Promise dependency resolution order in angular ui-router

前端 未结 4 930
野性不改
野性不改 2020-12-15 06:11

I have set up a top-level controller that is instantiated only when a promise (returned by a Config factory) is successfully resolved. That promise basically do

4条回答
  •  死守一世寂寞
    2020-12-15 06:38

    Similarly to @Kasper Lewau's answer, one may specify a dependency on resolves withing a single state. If one of your resolves depends on one or more resolve properties from the same resolve block. In my case checkS relies on two other resolves

    .state('stateofstate', {
        url: "/anrapasd",
        templateUrl: "views/anrapasd.html",
        controller: 'SteofsteCtrl',
        resolve: {
            currU: function(gamMag) {
                return gamMag.checkWifi("jabadabadu")
            },
            userC: function(gamUser, $stateParams) {
                return gamUser.getBipi("oink")
            },
            checkS: ['currU', 'userC', 'gamMag', function(currU, userC, gamMag) {
                return gamMag.check(currU, userC);
            }]
        }
    })
    

    **PS: **Check the "Resolves" section of the following document for more details about the inner-workings of resolve.

提交回复
热议问题