JSFiddle - React, Tailwind, and code Playground
by sveinatle
HTML
<div ng-controller="AngularCtrl">
<div ng-init="sayHello()">Demo ng-init</div>
<div ng-click="sayHi()">Demo clickable (yes, please click me)</div>
</div>
JavaScript
angular.module('myApp',[]);
function AngularCtrl($scope) {
$scope.user_name = 'John';
$scope.sayHello = function(){
alert('Element with ng-init processed - Hello '+$scope.user_name);
}
$scope.sayHi = function(){
alert('Clickable clicked - Hi '+$scope.user_name);
}
$scope.sayHowdy = function(){
alert('Initialized controller - Howdy '+$scope.user_name);
}
$scope.sayHowdy();
}