富贵资源网 Design By www.hznty.com

1. templateURL和路由之类的要在web server下运行。

2. 使用模板replace设为true,模板里也要有相应的标签,否则不出现任何数据。

3. 1.2版本之后,ngRoute模块独立。

4.空的controller不定义会出错。

5.Directive的link参数是有顺序的:scope,element,attrs,ctrl

6.ng-repeat不能循环重复的对象。hack: ng-repeat="thing in things track by $id($index)"

7.尽量更新的是变量的属性而不是单个变量本身。

8.注意ng-repeat,ng-controller等会产生独立作用域。

9.当jquery载入,则使用jquery,否则使用内置jqlite。all element references in Angular are always wrapped with jQuery or jqLite; they are never raw DOM references.

10.Uncaught Error: [$location:ihshprfx]  A标签没有去掉 <a href="#" ng-click="someMethod();"></a>

11.Error: listen EACCES 当在linux下,会出现这个错误,因为你监听的端口的原因,这里我的是33。把它改成8080或3030之类大的端口数就可以了。有一个规定,这些端口最好是大于1024。

12. select在没有ng-model的时候,无法显示。同理,当遇到无法显示最好看文档少了什么。

补:当ng-options的源,跟书写不相配时会出现全部选择的情况,如下:

var a = [{"id":1,"name":"Ryan"}....] ,ng-options="item.i as item.name for item in a"  // i与id不同

----------------------------------------------------------------------------------------

13.ng-bind-html-unsafe已去除,可以用['ngSanitize'] 模块或使用$sce服务

From stackoverflow

You indicated that you're using Angular 1.2.0... as one of the other comments indicated, ng-bind-html-unsafe has been deprecated.

Instead, you'll want to do something like this:

复制代码 代码如下:<div ng-bind-html="preview_data.preview.embed.htmlSafe"></div>

In your controller, inject the $sce service, and mark the HTML as "trusted":

复制代码 代码如下:myApp.controller('myCtrl', ['$scope', '$sce', function($scope, $sce) {
  // ...
  $scope.preview_data.preview.embed.htmlSafe =
     $sce.trustAsHtml(preview_data.preview.embed.html);
}

Note that you'll want to be using 1.2.0-rc3 or newer. (They fixed a bug in rc3 that prevented "watchers" from working properly on trusted HTML.)

查看更多AngularJS的语法,大家可以关注:AngularJS 参考手册英文版,也希望大家多多支持。

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。