【发布时间】:2014-03-09 20:01:37
【问题描述】:
对于我的生活,我无法弄清楚为什么这个主页会加载到底部。这是 Angular ui-router、angular、javascript 还是 CSS 问题?我已经坚持了两个小时,不知道为什么我的 html 页面加载在底部而不是顶部,这真的扼杀了我作为程序员的自尊:/
这里是主页:[ URL Redacted ]
更新 -- 我解决了这个问题。它与 Angular UI-Router 一起使用。有关简单修复,请参阅下面的答案。
我使用 Angular 和 Angular UI-Router,设置看起来像这样......
default.jade
doctype html
html(lang='en', xmlns='http://www.w3.org/1999/xhtml', xmlns:fb='https://www.facebook.com/2008/fbml', itemscope='itemscope', itemtype='http://schema.org/Product')
include ../includes/head
body(ng-controller="RootController")
block content
include ../includes/foot
index.jade
extends layouts/default
block content
section.container
div(ui-view="header")
div(ui-view="content")
div(ui-view="footer")
Angular Config.js
window.app.config(function($stateProvider, $urlRouterProvider) {
// For any unmatched url, redirect to "/"
$urlRouterProvider.otherwise("/");
// Now set up the states
$stateProvider
.state('home', {
url: "/",
views: {
"header": { templateUrl: "views/header/home.html" },
"content": { templateUrl: "views/content/home.html" },
"footer": { templateUrl: "views/footer/footer.html" }
},
resolve: { factory: setRoot }
})
.state('signin', {
url: "/signin",
views: {
"header": { templateUrl: "views/header/signin.html" },
"content": { templateUrl: "views/content/signin.html" },
"footer": { templateUrl: "views/footer/footer.html" }
},
resolve: { factory: setRoot }
})
【问题讨论】:
标签: javascript css angularjs express angular-ui-router