angularjs路线正在更改我的url
我似乎无法运行我的路线 如果我转到:,它会将我的url更改为:。这也不起作用: 运行angularjs 1.6和路线1.6。我也在使用GulpWebServer routes.js:angularjs路线正在更改我的url,angularjs,Angularjs,我似乎无法运行我的路线 如果我转到:,它会将我的url更改为:。这也不起作用: 运行angularjs 1.6和路线1.6。我也在使用GulpWebServer routes.js: angular.module('NoteWrangler').config(function($routeProvider){ $routeProvider.when('/notes', { templateUrl: '/templates/pages/notes/index.html' })
angular.module('NoteWrangler').config(function($routeProvider){
$routeProvider.when('/notes', {
templateUrl: '/templates/pages/notes/index.html'
})
});
index.html:
<div class="wrapper">
<div ng-view>
</div>
</div>
<script src="/node_modules/jquery/dist/jquery.js" charset="utf-8"></script>
<script src="/node_modules/angular/angular.js" charset="utf-8"></script>
<script src="/node_modules/angular-route/angular-route.js" charset="utf-8"></script>
<script src="app.js"></script>
<script src="routes.js"></script>
您做得不错,但angular 1.6.x中引入了$locationProvider的一个更改。在此版本之前,hashprefix的默认值为空,但现在为“!” 检查 及 因此,修改route.js如下 角度。模块“NoteWrangler”。配置函数$routeProvider,$locationProvider{ $locationProvider.hashPrefix; //$locationProvider.html5Modefalse; //false是默认值,因此不需要设置 $routeProvider.when'/notes'{ templateUrl:“/templates/pages/notes/index.html” }
};只是一个建议,请使用ui路由器。我猜您的问题与此可能的重复相同,并检查其他解决方案
var gulp = require('gulp');
var webserver = require('gulp-webserver');
gulp.task('webserver', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
open: true
}));
});