Three different ways:
- mode one:<h5>{{msg}}</h5> This method flashes when the page is refreshed {{}}
- <h5 ng-bind = "msg" ></h5< Span style= "color: #0000ff;" >>
- Way Three:<h5 Ng-clock class= "Ng-clock">{{msg}}</h5>
Example code:
<!DOCTYPE HTML><HTMLLang= "en"Ng-app= "MyApp"><Head> <MetaCharSet= "UTF-8"> <title>Angularjs12-three ways to implement data binding</title> <Linkrel= "stylesheet"href= "Http://cdn.bootcss.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css"/></Head><Body> <DivNg-controller= "Myctrl"style= "padding:60px;"> <inputtype= "text"class= "Form-control"Ng-model= "MSG"> <!--Mode 1 - <h5>{{msg}}</h5> <!--Mode 2 - <h5Ng-bind= "MSG"></h5> <!--Mode 3 - <h5Ng-clock class= "Ng-clock">{{msg}}</h5> </Div> <Scriptsrc= "Http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></Script> <Script>Angular.module ('MyApp', []). Controller ('Myctrl',function($scope) {$scope. msg= 'Hello angular!' }) </Script></Body></HTML>
Angularjs Learning--three ways to achieve data binding