Alibabaev
Alibabaev

Reputation: 71

How to return result of function in HTML at Angular?

How to return result in HTML template from fnuction Angular JS?

HTML:

<div>{{getName({{type}})}}</div>

Angular JS:

$scope.getName = function (type){
  return 'Bob';
}

I need to get Bob in DIV element

Upvotes: 0

Views: 57

Answers (2)

Reena
Reena

Reputation: 1119

As you didn't give the type parameter any value. So I just pass it 1

Try this:

{{getName(1)}}

Upvotes: -1

Jonathan
Jonathan

Reputation: 3644

Remove the second pair of curly braces. {{getName(type)}} is sufficient.

Upvotes: 4

Related Questions