Skip to content

Instantly share code, notes, and snippets.

@qqilihq
Created May 11, 2017 15:47
Show Gist options
  • Save qqilihq/7bf8d284fed16f987d196b8fbdc488a9 to your computer and use it in GitHub Desktop.
Save qqilihq/7bf8d284fed16f987d196b8fbdc488a9 to your computer and use it in GitHub Desktop.
Angular 1.6 minimal working example
<!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>
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