Created
February 16, 2016 11:05
-
-
Save davinkevin/7ca8f182e1f2002e2f3d to your computer and use it in GitHub Desktop.
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 ng-app="plunker"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>{{ name }}</title> | |
<script>document.write('<base href="' + document.location + '" />');</script> | |
<link rel="stylesheet" href="style.css" /> | |
<script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.16/angular.js" data-semver="1.2.16"></script> | |
<script src="app.js"></script> | |
</head> | |
<body ng-controller="MainCtrl as ctrl"> | |
Le nom : <input type="text" ng-model="ctrl.name"> <button ng-click="ctrl.register()"> Show in Log </button> | |
<div ng-show="ctrl.name" >Hello {{ ctrl.name }}</div> | |
<input type="text" ng-model="ctrl.filter"> | |
<div>Registered Users</div> | |
<table> | |
<thead> | |
<th>Name</th> | |
<th>Date</th> | |
</thead> | |
<tbody> | |
<tr ng-repeat="user in ctrl.users | filter: {name : ctrl.filter}"> | |
<td>{{ user.name }}</td> | |
<td>{{ user.date | date | uppercase }}</td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html> |
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
// Déclaration de l'application : (Cf <html ng-app="plunker"> ) | |
var app = angular.module('plunker', []); | |
// Déclaration d'un controller : (cf <body ng-controller="MainCtrl"> ) | |
app.controller('MainCtrl', function($log) { | |
var vm = this; | |
vm.name = "Foo"; | |
vm.users = []; | |
vm.register = function() { | |
vm.users.push({ | |
name : vm.name, | |
date : Date.now() | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment