Angular, première partie
This commit is contained in:
22
javascript/angular/directives-4.md
Normal file
22
javascript/angular/directives-4.md
Normal file
@ -0,0 +1,22 @@
|
||||
# .cadoles-slide-title[Les directives de base (4/)]
|
||||
|
||||
**Conditions dans les templates: `ng-show`, `ng-hide`, `ng-switch`**
|
||||
```html
|
||||
<html>
|
||||
<body ng-app="myApp">
|
||||
<div ng-controller="MainCtrl" ng-init="myTest = true; myVal = 'foo'">
|
||||
|
||||
<span ng-hide="myTest === true">Caché !</span>
|
||||
<span ng-show="myTest === true">Affiché !</span>
|
||||
|
||||
<div ng-switch="myTest === true">
|
||||
<span ng-switch-when="foo">Affiché !</span>
|
||||
<span ng-switch-when="bar">Caché !</span>
|
||||
<span ng-switch-default="baz">Caché !</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script src="angular.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
Reference in New Issue
Block a user