I am trying to use Angularjs . How can I show the result of a function in a view?
I have such HTML.
<body ng-controller="fooCtrl"> <p>a: {{ a }}</p> <p>b: {{ b }}</p> </body>
And javascript for it.
fooApp.controller('fooCtrl', ['$scope', function ($scope) { $scope.a = 3; $scope.b = function(){ return 4; }; }]);
a displayed correctly, but b empty. What am I doing wrong?
javascript angularjs
ironsand
source share