<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>
<script src="controller.js"></script>
<title>External Controller</title>
</head>
<body ng-controller="MyCtrl">
Name: <input ng-model="name" placeholder="Enter name"><br>
<p>{{name}} — Count: {{count}}</p>
<button ng-click="increment()">+</button>
</body>
</html>
angular.module('myApp', [])
.controller('MyCtrl', function($scope){
$scope.name="";
$scope.count=0;
$scope.increment=function(){ $scope.count++; };
});
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter