मेरे पास एक AngularJS ऐप है जो $routeProvider
और $stateProvider
का उपयोग करता है। मैं अपने सभी मार्ग/राज्य /
से अलग करने के लिए प्राप्त कर सकता हूं।AngularJS: रूट प्रदाता रूट पर नहीं काम करता है
यहाँ मेरी app.js फ़ाइल
var MailStash = angular.module("MailStash", ['ui.compat', 'ngResource', 'ngSanitize', 'ui.directives']).
config(function($stateProvider, $routeProvider, $urlRouterProvider) {
$routeProvider
.when('/', { controller: ListCtrl, templateUrl: '/js/partials/list.html' });
$stateProvider
.state('templates', {
url: '/templates',
abstract: true,
templateUrl: '/js/partials/list.html',
controller: ListCtrl,
})
.state('templates.list', {
// parent: 'templates',
url: '',
views: {
'main_content': {
templateUrl: '/js/partials/templates.new.html',
controller:CreateCtrl,
},
}
})
.state('templates.view', {
parent: 'templates',
url: '/{templateId}',
views: {
'main_content': {
templateUrl: '/js/partials/templates.view.html',
controller: ViewCtrl,
},
},
})
.state('templates.new', {
url: '/new',
views: {
'main_content': {
templateUrl: '/js/partials/templates.new.html',
controller: CreateCtrl,
},
},
})
.state('templates.edit', {
parent: 'templates',
url: '/edit/{templateId}',
views: {
'main_content': {
templateUrl: '/js/partials/templates.edit.html',
controller: EditCtrl,
},
},
})
}
)
.run(
[ '$rootScope', '$state', '$stateParams',
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}]
);
...
कुछ भी नहीं होता है जब मैं /
करने के लिए जाना लेकिन जब मैं /#templates
उचित दृश्य पर जाएं और नियंत्रकों में लात है।
किसी को भी देख सकते हैं कि क्या गलत है मेरी $routeProvider
और /
क्यों जा रहा है कुछ भी नहीं कर रहा है?