我下面的代碼:爲什麼表達式在AngularJS示例中出現?
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<p>Try to change the names.</p>
<div ng-app="myApp">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
</body>
</html>
的上面的代碼在瀏覽器中輸出如下:
Full Name: {{firstName + " " + lastName}}
我的問題是,爲什麼表達式出現,因爲它是?
看起來你沒有聲明控制器。 – rrd
好友,你的[ng-controller]在哪裏(https://docs.angularjs.org/api/ng/directive/ngController) – sisyphus