I'm trying to use Angularjs
. How can I show a result of a function in a view?
I have a HTML like this.
<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
is properly shown, but b
is blank. What am I doing wrong?
b
is a function object
. To get result you need to actually call it.
Try
<p>b: {{ b() }}</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With