Anup Anup - 1 year ago 257
Javascript Question

AngularJS - Call function in HTML

I have made a function

in my
. This function needs to be called in my HTML page.

So what i tried is like this :-


I can see no results.

How to call function in HTML?

Answer Source

Attach getAge and user to the $scope of the pages controller.

$scope.user = user;
$scope.getAge = getAge;

Make sure you're doing this in the controller and setting up the controller correctly. It won't work unless you've set up a controller with this DOM view and injected the $scope service into the controller.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download