【发布时间】:2015-05-18 13:20:29
【问题描述】:
更新
AngularJS 现在可以工作了。切换到 WebStorm IDE,但设置也有问题,这对我有帮助:Bower "Git not in the PATH" error(Bower “Git not in the PATH”错误)。
很快我会再次尝试在 WebStorm 下进行 ngrouting。
如何从我的本地主机 URL 中删除 index.html?有类似的问题,但他们帮不了我。
这是我到目前为止所做的:
index.html:
<head><title>MyApp</title></head>
<body>
<div ng-view>
<a href="#/menu">Menu</a>
<a href="#/main">Main</a>
</div>
</body>
app.js:
var app = angular.module('myApp', [
'ngRoute',
'ngResource',
'HTML5ModeURLs'
});
config.js:
app.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
$route.html5Mode(true);
$routeProvider.
when('/menu', {
templateUrl: 'Modules/Menu/view.html',
controller: 'Modules/Menu/controller'
}).
when('/main', {
templateUrl: 'Modules/Main/view.html',
controller: 'Modules/Main/controller'
}).
otherwise({
redirectTo: '/menu'
});
}
]);
【问题讨论】:
-
这是只能在服务器端完成的事情,您使用的是哪种服务器? (Apache / node.js...)
-
我正在使用 IIS Express。
标签: javascript html angularjs iis iis-express