Jaseem Abbas
Jaseem Abbas

Reputation: 5230

How to set placeholder for an img tag in Angular?

How do I set a placeholder for an image in img in AngularJS? In my app I am dynamically setting an image using ng-src.

Upvotes: 1

Views: 260

Answers (1)

charlietfl
charlietfl

Reputation: 171669

Can use an OR in expression:

ng-src="{{myModel.avatar || placeHolderVariable}}"

Upvotes: 2

Related Questions