Angular UI-Router more Optional Parameters in one State

前端 未结 4 921
甜味超标
甜味超标 2020-11-29 06:45

How can I allow optional parameters to my routes without using a query string and only using one route name? I am currently specifying each route FIVE TIMES to allow for an

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 07:05

    Short answer....

    .state('login', {
        url: '/login/:a/:b/:c/:d',
        templateUrl: 'views/login.html',
        controller: 'LoginCtrl',
        params: {
            a: { squash: true, value: null },
            b: { squash: true, value: null },
            c: { squash: true, value: null },
            d: { squash: true, value: null },
        }
    })
    

提交回复
热议问题