ng-srcset

What is ng-srcset:ng-srcset used with in img tag for display image on the base of dynamic anularjs expression...
Description of ng-srcset:ng-srcset has priority 99.
ng-srcset add and display the image on the bases of dynamic content...
Syntax of ng-srcset:
<img ng-srcset="http://www.angularjsexample.com/myimages/{{imgname}} 2x" />
How to Use ng-srcset/ng-srcset Example::
Example 1:
<div ng-app="webapp">
    <div ng-init="imgname='abc.jpg'">
        <div>
            Angularjs Example of ng-srcset
            <img ng-srcset="http://www.angularjsexample.com/myimages/{{imgname}} 2x" />

        </div>
    </div>
</div>

Example 2:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr">
        <div>
            Angularjs Example of ng-srcset
            <img ng-srcset="http://www.angularjsexample.com/myimages/{{imgname}} 2x" />
        </div>
    </div>
</div>

<script>
    angular.module('webapp', []).controller('angularjsexampleCtlr', function ($scope, $http) {
        $scope.myfun = function () {
            $scope.imgname = 'abc.jpg';
        }
    });
</script>

1 comment :