this is my web page
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
</head>
<body ng-controller="imgController">
<img src={{imgsrc}} />
<script type="text/javascript">
var imgController=function($scope){
$scope.imgsrc='http://su.bdimg.com/static/superpage/img/logo_white.png';
};
</script>
</body>
</html>
this is only an example, I want to get assign a image src via angular scope,but before angular work, the broswer will first requet the url {{imgsrc}}. Of course,it's a bad url, so it's a err, it's ugly, so what should i do?I will get the image resources vai angular scope, but I don't want a bad request first.
Use the ngSrc directive which solves that problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With