Could you please explain why method 1 (binding to property) does not work, while method 2 (binding to function return value) does?
Including relevant code here. Please post a comment if you require any additional code.
function MyController(myService) {
// Method 1: A property
this.backgroundImagePath = login.backgroundImagePath;
// Method 2: A function
this.getBackgroundImagePath = function () {
return login.backgroundImagePath;
};
}
Then in my HTML code, I have:
<!-- Does not work -->
<img data-ng-src="{{ myController.backgroundImagePath }}" />
<!-- Works as expected -->
<img data-ng-src="{{ myController.getBackgroundImagePath() }}" />