引导导航栏与angularjs [英] Bootstrap navbar with angularjs

查看:143
本文介绍了引导导航栏与angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得一个引导导航栏与angularjs工作。我想有在index.html的导航栏,并在其各自的部分导航栏每个选项卡的内容的其余部分。我遇到了麻烦谐音露面。

I am trying to get a bootstrap navbar working with angularjs. I would like to have the navbar in the index.html and the rest of the content for each tab in the navbar in its own respective partial. I am having trouble getting the partials to show up.

<一个href=\"http://plnkr.co/edit/sKJU4nrNYV56uJQG4Lvw?p=$p$pview\">http://plnkr.co/edit/sKJU4nrNYV56uJQG4Lvw?p=$p$pview

推荐答案

有几个你的问题code。请与您的版本进行比较我的修补程序。 ( Plnkr

There are couple of issues of you code. Please compare my fix with your version. (Plnkr)


  1. 您应该使用配置()注册的路由规则。

  2. 您需要把 NG-视图在HTML页面,并确保它是 NavCtrl <范围内/ LI>
  3. 在路由规则控制器名称应该是一个字符串。你错过了引号。

  4. 您应该使用NG-点击触发加载页面,而不是HREF。请记住,路由是Angularjs的范围而不是HTML。

  1. You should use config() to register the routing rules.
  2. You need put ng-view in the html page and make sure it is inside the scope of NavCtrl
  3. The controller name in the routing rules should be a string. You missed the quotes.
  4. You should use ng-click to trigger to load the page rather than href. Keep in mind, the routing is in Angularjs's scope not html.

这篇关于引导导航栏与angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆