Angular新手可能遇到的问题

Q1:<section ng-include="partials/setting.html"> </section> 错在哪里?怎么html加载不出来!

正确写法:

<section ng-include=" 'partials/setting.html' ">  

注意:
1:双引号和单引号之间有空格
2:确保页面是在服务器上就是或要用http协议访问页面


Q2:点击表头排序没有效果?

 <th     ng-repeat="x in head_data"  >
      <span ng-click="sort_text='{{x.sort}}';desc=!desc">      {{x.name}}</span>
</th>

如果你的表头是用“ng-repeat”生成出来的,那么很不幸的告诉你,排序的效果是没有的!
把它换成下面的直接输出方法就可以了。至于原因,我也不知道。估计表头不是用对象方式输出,直接输出的是名字估计也是可以的,这个我没有去试。

     <tr>
                <th  ng-click="sort_text='pid';desc=!desc" >ID</th>
                <th  ng-click="sort_text='fname';desc=!desc" >first name</th>
                <th  ng-click="sort_text='lname';desc=!desc" >last name</th>
                <th  ng-click="sort_text='logname';desc=!desc" >login name</th>
                <th  ng-click="sort_text='company';desc=!desc" >company</th>
                <th  ng-click="sort_text='email';desc=!desc" >email</th>
                <th>notifications</th>
                <th >active</th>
                <th>assume</th>
                <th>edit</th>
         </tr>

Q3:ng-keyup(fun())怎么木有反应?用"ui-bootstrap-tpls-1.1.1.min.js"时候'ui.bootstrap' 怎么一直报错?

坑爹的!angular版本太低了!换高版本的就可以了!


Q4:高版本的angular中我用定义函数方式["* Controllers */function ctrDataList($scope) {......})]定义控制器,怎么一直报错说没有这个函数?

坑爹了!它不支持这样定义控制器!换成"ngular.module('ui.setting.controllers', [ ]) .controller('ctrDataList', function($scope) {})"就可以了.


Q5:angular中"ng-click="removeNewTab({{tab.id}})"这样给函数传参是不对的

正确的写法:ng-click="removeNewTab(tab.id)" 






















你可能感兴趣的:(AngularJS,ng-include,Angular排序没有效果)