I'm lost, could you help me?
I have a value in the $scope which is retrieved from JSON file:
in Controller:
$scope.scopeTitle = title;
in JSON file:
"title": "fruit.ID || 'Empty'"
The fruit.ID
is retrieved from backend, and I want to display it's ID in my HTML.
Everything is works fine if in my HTML I do sth like:
<span class="navbar-brand" data-ng-bind="fruit.ID || 'Empty'" />
the result on the HTML is:
FRUIT/12 or Empty <- and it's good
If I want to pass it via $scope, like this:
<span class="navbar-brand" data-ng-bind='scopeTitle' />
it's not working, the result on the HTML is:
fruit.ID || 'Empty' <- it's not good
My HTML is generated in template in directive and I'm using a $compile function to compile the HTML code.
How to write the ng-bind expression properly to achieve the result via $scope?