1. templateURL和路由之類的要在web server下運行。html
2. 使用模板replace設爲true,模板裏也要有相應的標籤,不然不出現任何數據。jquery
3. 1.2版本以後,ngRoute模塊獨立。linux
4.空的controller不定義會出錯。git
5.Directive的link參數是有順序的:scope,element,attrs,ctrlgithub
6.ng-repeat不能循環重複的對象。hack: ng-repeat
=
"thing in things track by $id($index)"
web
7.儘可能更新的是變量的屬性而不是單個變量自己。app
8.注意ng-repeat,ng-controller等會產生獨立做用域。this
9.當jquery載入,則使用jquery,不然使用內置jqlite。all element references in Angular are always wrapped with jQuery or jqLite; they are never raw DOM references.code
10.Uncaught Error: [$location:ihshprfx] A標籤沒有去掉 <a href="#" ng-click="someMethod();"></a>server
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服務
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.)