2015-06-10 39 views
2

我的代碼就像AngularJs無法讀取預先定義的輸入值

<p>Input something in the input box:</p> 
<p>Name : <input type="text" ng-model="name" placeholder="Enter name here" value="something" ></p> 
<h1>Hello {{name}}</h1> 

我要像

Input something in the input box: 
**Hello something** (by default) 

回答

2

顯示輸出你可以在你的情況下使用ng-initng-init="name='somthing'"

標記

<p ng-init="name='somthing'">Input something in the input box:</p> 
<p>Name : <input type="text" ng-model="name" placeholder="Enter name here" /></p> 
<h1>Hello {{name}}</h1> 
+0

感謝它的工作... –

+0

@ Sathibabu-Nyros很樂意幫助你..謝謝:) –

相關問題