使用angular route url formation #!/ issue
Using angular route url formation #!/ issue
我正在学习课程 Staying Sharp With AngularJs。
课程在app.ts
中放了一些代码:
angular
.module("NoteWrangler", ["ngRoute"])
.config(function ($routeProvider: angular.route.IRouteProvider) {
$routeProvider
.when("/notes", {
templateUrl: "templates/pages/notes/index.html"
});
});
好的,所以链接是这样形成的:
somedomain/index.html/#/myPage
但是当我尝试我的 url 是这样构建的:
somedomain/index.html#!/myPage
为什么不同?
我的意思是在 ".../#/..."
和 "...#!/..."
之间。
我该如何在这两者之间切换?
在 angular 中,它被称为 shebang 并与您的 ngroute class 密切合作。 This topic 包含一些详尽的答案
Why the difference?
旧版本的 Angular 使用了 #
。
几年前,它被更改为使用 #!
,因此它可以很好地与(现已弃用)Google Ajax crawling spec.
一起使用
我正在学习课程 Staying Sharp With AngularJs。
课程在app.ts
中放了一些代码:
angular
.module("NoteWrangler", ["ngRoute"])
.config(function ($routeProvider: angular.route.IRouteProvider) {
$routeProvider
.when("/notes", {
templateUrl: "templates/pages/notes/index.html"
});
});
好的,所以链接是这样形成的:
somedomain/index.html/#/myPage
但是当我尝试我的 url 是这样构建的:
somedomain/index.html#!/myPage
为什么不同?
我的意思是在 ".../#/..."
和 "...#!/..."
之间。
我该如何在这两者之间切换?
在 angular 中,它被称为 shebang 并与您的 ngroute class 密切合作。 This topic 包含一些详尽的答案
Why the difference?
旧版本的 Angular 使用了 #
。
几年前,它被更改为使用 #!
,因此它可以很好地与(现已弃用)Google Ajax crawling spec.