首页 > 代码库 > angurlarJS

angurlarJS

<!doctype html>
<html>
<head>
<script src="http://www.mamicode.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<script  src="http://www.mamicode.com/angular-1.0.1.min.js" type="text/javascript"></script>

</head>
<body>
<div ng-app="app" ng-controller="parentCtr" id="testdiv">
    
 
</div>

</body>
<script>





angular.module("app", []).controller("parentCtr",
function ($scope,$compile) {
    var html = ‘<div>name :<input ng-model="name" type="text" ng-change="change()" /></div>‘;
    $("#testdiv").html(
    $compile(html)($scope)
    );
    $scope.change = function (){
        console.log("hellojava");
        
    };
});
</script>
</html

angurlarJS