AngularJS UI router handling 404s

前端 未结 6 1600
粉色の甜心
粉色の甜心 2020-12-03 01:48

I have an app with a service which wraps my API calls:

var ConcernService = {
    ...
    get: function (items_url, objId) {
        var defer = $q.defer();
         


        
6条回答
  •  甜味超标
    2020-12-03 02:45

    $urlRouterProvider.otherwise('/page-not-found');

    .state('error', {
      url: "/page-not-found",
      templateUrl: "templates/error.html",
      controller: "errorController"
    })
    

    Will handle your page not found problem.

    If you want to raise 404 found purposefully use the state or url. We have created a separate controller just if you want to perform any operations.

提交回复
热议问题