samedi 9 mai 2015

Angular Ui router allowing API route

I have an AngularJS SPA Template for visual studio in my project and a WebApi 2.2 in the same project. But everytime I go to a /api link it gives me the 404 error

so I figured the routing isn't setup correct. Thisis the route provider:

$stateProvider
    .state('home', {
        url: '/',
        templateUrl: '/views/index',
        controller: 'HomeCtrl'
    })
    .state('about', {
        url: '/about',
        templateUrl: '/views/about',
        controller: 'AboutCtrl'
    })
    .state('units', {
        url: '/units',
        layout: 'basic',
        templateUrl: '/views/units',
        controller: 'UnitCtrl'
    })
    .state('otherwise', {
        url: '*path',
        templateUrl: '/views/404',
        controller: 'Error404Ctrl'
    });

$locationProvider.html5Mode(true);

So I don't know if I should add a state for the api or change the otherwise path? and what to add

Aucun commentaire:

Enregistrer un commentaire