我正在尝试使用ui-router创建一个简单的应用程序。当我第一次加载页面或重新加载当前页面时,一切都正常。但是当我点击不同的页面时,整个应用程序会在我的ui-view中重新加载,并在日志中收到警告:“警告:尝试多次加载angular。” 我正在使用Express,Jade和Angular。
我的结构如下:
我的结构如下:
public
app
frontPage
frontPage.jade
institution
institution.jade
app.js
index.jade
server
server.js
server.js:
app.use(express.static(path.join(__dirname, '/public')));
app.get('/*', function (req, res) {
res.sendfile('./public/app/index.html');
});
app.js:
$locationProvider.html5Mode(true);
$stateProvider
.state('frontPage', {
url: '/app/frontPage/',
templateUrl: 'frontPage.html'})
.state('institution', {
url: '/app/institution/',
templateUrl: 'institution.html',
controller: 'institutionCtrl'
});
});
index.jade
#page-wrapper
.row
.col-lg-12
<ui-view></ui-view>
frontPage.jade
block content
h1 Page
p Welcome
在使用ng-route时,上述结构是可行的,但当我切换到ui-router时,页面为何会重新加载整个页面,我感到很困惑。