Prev Demo
AngularJS
>
Attaching Functions
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script> var app = angular.module('app', []); app.controller('myController', ['$scope', function($scope) { $scope.Square = function(val) { return 2 * 2; }; }]); </script> </head> <body> <h2>Attach functions or behavior - AngularJS</h2> <div ng-app="app" ng-controller="myController"> Square of 2 is {{ Square() }} </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output