Answer the question
In order to leave comments, you need to log in
Why doesn't ng-checked work with append HTML code?
There is a code:
<body ng-app="App" ng-controller="AppCtrl">
<div class="container">
<form ng-submit="newTask()">
<input type="checkbox" ng-model="checkAll">
<input id="one" type="text" ng-model="text" name="text" placeholder="What tododo?">
</form>
<input id="two" type="checkbox" ng-checked="checkAll">
</div>
</body>
var App = angular.module("App", []);
App.controller('AppCtrl', function ($scope) {
$scope.list = [];
$scope.newTask = function () {
if ($scope.text) {
$('.container').append("<div class='task'><input id="appended" type='checkbox' ng-checked='checkAll'/>" + this.text + "</div>");
$scope.list.push(this.text);
$scope.text = '';
}
};
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question