Created
May 11, 2017 15:47
-
-
Save qqilihq/7bf8d284fed16f987d196b8fbdc488a9 to your computer and use it in GitHub Desktop.
Angular 1.6 minimal working example
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>AngularJS minimal example for Klemens</title> | |
</head> | |
<body ng-app="myApp"> | |
<h1>AngularJS minimal example for Klemens</h1> | |
<div ng-controller="myController as ctrl"> | |
<p>Value: <span ng-bind="ctrl.value"></span></p> | |
<button type="button" ng-click="ctrl.increment(1)">Increment</button> | |
<button type="button" ng-click="ctrl.increment(-1)">Decrement</button> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> | |
<script src="scripts.js"></script> | |
</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
angular | |
.module('myApp', []) | |
.controller('myController', [function() { | |
this.value = 0; | |
this.increment = function(by) { | |
this.value += by; | |
console.log('incremented by ' + by + ', new value ' + this.value); | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment