此代码无效。直接打印{{name |大写}} ..
你能帮助我吗?
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body ng-app="myApp">
<p>Name:<input type="text" ng-model="name">
</p>
<h3>{{ name | uppercase }}</h3>
答案 0 :(得分:0)
您的 ng-controller 缺失
试试这个:
<div ng-app="myApp" ng-controller="caseCtrl">
<input type="text" ng-model="txt" />
<h3>{{txt | uppercase}}</h3>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('caseCtrl', function($scope) {
$scope.txt = "Hello World!";
});
</script>