<!doctype html>
<html ng-app="app">
<head>
<script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.js"></script>
</head>
<body>
<div ng:controller="list">
<div class="message">
message
</div>
<input class="test" type="button" value="test" ng-click="callajax()">
</div>
</body>
</html>
<script>
var app = angular.module('app',[]);
app.controller('list',function($scope,$element,$http){
$scope.testvalue = "matt";
$scope.callajax = function(){
$http.get('ajax.php').success(function(data){
$element.parent().find('.message').html(data);
});
}
});
</script>
ajax.php
<input type="text" ng-model="testvalue">
我点击 test,ajax 去,获取的不会被填充啊,我用 knockout 会重新编译,angularjs 不会,求教下