Skip to content

Instantly share code, notes, and snippets.

@gmittica
Created October 17, 2017 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmittica/3a562088e466937636d533a33ad47319 to your computer and use it in GitHub Desktop.
Save gmittica/3a562088e466937636d533a33ad47319 to your computer and use it in GitHub Desktop.
Lesson // source http://jsbin.com/kofunuh
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.6.6/angular-locale_it-it.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-message-format.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Lesson</title>
</head>
<body ng-app="myApp">
<div class="container" ng-controller="myCtrl">
<div class="well">
<h4>Items: {{ items }} - Who: {{ who }}</h4>
<p>
<button class="btn btn-info" ng-click="items = items - 1">-1</button>
<button class="btn btn-info" ng-click="items = items + 1">+1</button>
<button class="btn btn-danger" ng-click="who = 'male'">male</button>
<button class="btn btn-danger" ng-click="who = 'female'">female</button>
</p>
<h3>
{{ items, plural,
=0 {There are not items}
=1 { There is one item}
other { There are {{ items }} items} }}
</h3>
<h3>
<ng-pluralize
count="items"
when="{0: 'There are not items', 1: 'There is one item', other: 'There are {{ items }} items'}"
></ng-pluralize>
</h3>
<h3>
{{ who, select,
male { he is...}
female { she is... }
other {}
}}
</h3>
</div>
</div>
<script id="jsbin-javascript">
angular.module("myApp", ['ngMessageFormat'])
.controller("myCtrl", ['$scope', function($scope) {
$scope.items = 0;
$scope.who = 'female'
}]);
</script>
<script id="jsbin-source-javascript" type="text/javascript">angular.module("myApp", ['ngMessageFormat'])
.controller("myCtrl", ['$scope', function($scope) {
$scope.items = 0;
$scope.who = 'female'
}]);</script></body>
</html>
angular.module("myApp", ['ngMessageFormat'])
.controller("myCtrl", ['$scope', function($scope) {
$scope.items = 0;
$scope.who = 'female'
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment