我在这个stateProvider中使用angularjs ui-router:
.state("admin", {
abstract:true,
url: "/admin",
templateUrl: "/app/template/adminabstract.html",
controller: "AdminAbstractController"
})
.state("admin.view1", {
url: "/view1",
templateUrl: "/app/template/adminview1.html",
controller: "AdminView1Controller"
}).state("admin.view2", {
url: "/view2",
templateUrl: "/app/template/adminview2.html",
controller: "AdminView2Controller"
})下面是当前的本地主机链接:
http://localhost:52058/index.html#/admin/view2
它在本地主机中工作得很好,但是当我发布到服务器上时,它就不再工作了。下面是链接在服务器上的样子:
http://specific.com/appname/otheridentifier/index.html#/admin/view2
为了让我的应用程序在发布时正常工作,我认为我需要更改我的ui路由器配置或状态提供程序,以便我的localhost
http://localhost:52058/index.html#/appname/otheridentifier/admin/view2
我在正确的轨道上吗?我需要做些什么才能让它正常工作?
发布于 2015-08-06 23:48:48
因为你的网站看起来不像是在网站的根目录中,所以你不能这样做
templateUrl: "/app/template/adminview1.html"/是说看看这个网站的根目录,所以它看起来
http://specific.org/app/template您可能希望将模板地址更改为
templateUrl: "/appname/otheridentifier/app/template/adminview1.html"https://stackoverflow.com/questions/31860073
复制相似问题