为什么AngularJS不呈现表达式?
<!DOCTYPE html>
<html>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
<p>Person</p>
<div mg-app="myApp" ng-init="g=9.8" ng-controller="myCtrl">
First name <input type="text" ng-model="firstName"><br>
Last name <input type="text" ng-model="lastName"><br>
Birthday <input type="date" ng-model="birthday"><br>
{{firstName+' '+lastName}} was born on {{birthday}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
$scope.birthday= "2015/1/1";
});
</script>
</body>
</html>
它给出了
{{firstName +''+ lastName}}诞生于{{birthday}}
而不是表达评估
答案 0 :(得分:4)
拼写错误:
mg-app => ng-app
答案 1 :(得分:0)
<!DOCTYPE html>
<html>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
<p>Person</p>
<div ng-app="myApp" ng-init="g=9.8" ng-controller="myCtrl">
First name <input type="text" ng-model="firstName"><br>
Last name <input type="text" ng-model="lastName"><br>
Birthday <input type="date" ng-model="birthday"><br>
{{firstName}} {{lastName}} was born on {{birthday}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
$scope.birthday= "2015/1/1";
});
</script>
</body>
</html>
&#13;