All:
I am pretty new to AngularJS, my question is how to dynamically add elements to page within a scope.
Like:
<div id="cnt" ng-controller="main">
<button>Add more</button>
</div>
<script>
app.controller("main", function($scope){
$scope.name = "hello";
});
$("button").on("click", function(){
var div = $("#cnt").append("div");
div.html("{{name}}");
});
</script>
What It is supposed to happen is the newly added div will have the name auto binded( shown as "hello"). But when I click the button, it only add more div with "{{name}}" in it.
I wonder what is the best way to do this?