找了半天錯(cuò)誤,沒發(fā)現(xiàn)哪里有問題,控制臺(tái)也沒報(bào)錯(cuò),又跑去看官方文檔,還是沒有發(fā)現(xiàn)。
頁面始終是空白的,有沒有遇到同樣情況的指導(dǎo)一下,剛開始學(xué)angular。
index.html
app.js
main.html
content.html
想要在main.html添加固定的頭部和側(cè)邊欄,可是一直顯示不出來,頁面都是一片空白。
業(yè)精于勤,荒于嬉;行成于思,毀于隨。
1.把index.html中ui-view那個(gè)class去掉。
2.路由里,$urlRouterProvider.otherwise('/main');
這樣寫:
.state('book', {
url: '/book',
template: '<p ui-view></p>',
abstract: true,
resolve: {
load: ['$ocLazyLoad',
function($ocLazyLoad) {
return lazyDeferred = $ocLazyLoad.load([{
files: [
'./css/book.css'
]
}, {
name: '73go.book',
files: [htmlBase + 'book/main.js']
}]);
}
]
}
})
.state('book.list', {
url: '',
templateUrl: htmlBase + 'book/list.html',
data: {
title: '需求及方案'
}
})
resolve 你可以不用管,是跟OClazyLoad的搭配
abstract: true,設(shè)置了這個(gè),界面就顯示不出來了。你main設(shè)置了