What's the difference between ng-model and ng-bindhtml
ng-bind has one-way data binding ($scope --> view). It has a shortcut {{ val }} which displays the scope value $scope.val inserted into html where val is a variable name.浏览器
ng-model is intended to be put inside of form elements and has two-way data binding ($scope --> view and view --> $scope) e.g. <input ng-model="val"/>.ide
ng-bind是从$scope -> view的单向绑定
ng-modle是$scope <-> view的双向绑定双向绑定
在AngularJS中显示模型中的数据有两种方式:orm
<p>{{text}}</p>htm
另外一种是使用基于属性的指令,叫作ng-bind:element
<p ng-bind="text"></p>input
主要区别在于,使用花括号语法时,在AngularJS使用数据替换模板中的花括号时,第一个加载的页面,一般是应用中的index.html,其未被渲染的模板可能会被用户看到。而使用第二站方法的视图不会遇到这种问题。form
缘由是,浏览器须要首先加载index.html页面,渲染它,而后AngularJS才能把它解析成你指望看到的内容。模板
因此,对于index.html页面中的数据绑定操做,建议采用ng-bind。那么在数据加载完成以前用户就不会看到任何内容。