Requirement description: There is a myimg variable in the page. I can use $scope.myimg='xxx' in the controller to give it an initial value. But if assignment is not allowed in the control, what about in the img tag? Give it an initial value?
<img ng-src='./img/{{myimg}}.png'>
淡淡烟草味2017-05-15 16:56:28
This is the same operation as adding a default value when initializing a value in JavaScript, just use ||
.
<img ng-src='./img/{{myimg || 'default'}}.png'>