Last active
May 10, 2016 11:25
-
-
Save krawaller/b9b228b740ba3ef3763ff6b6db494850 to your computer and use it in GitHub Desktop.
angular cheating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Exercise 1</title> | |
<script src="../jquery.js"></script> | |
<script src="../angular.js"></script> | |
<style> | |
.selected { | |
text-decoration: line-through; | |
} | |
</style> | |
</head> | |
<body ng-app="app" ng-controller="Ctrl"> | |
<div ng-repeat="issue in issues" class="test" ng-class="{selected:issue.selected}"> | |
<input type="checkbox" ng-model="issue.selected"> | |
{{issue.text}} | |
</div> | |
<input type="text" ng-model="newIssue" placeholder="new issue"/> | |
<button ng-click="addNewIssue()">Add issue</button> | |
<pre ng-bind="issues | json"/> | |
<script type="text/javascript"> | |
var app = angular.module('app', []); | |
app.controller('Ctrl',function($scope){ | |
$scope.issues = [ | |
{text: 'do the dishes'}, | |
{text: 'take out trash'}, | |
{text: 'make the bed'} | |
]; | |
$scope.addNewIssue = function(){ | |
$scope.issues.push({text:$scope.newIssue}); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment