Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- angular.module('myApp').directive('listImg', function() {
- return {
- retrict: 'E',
- templateUrl: 'templates/list-img.html',
- scope: {
- show: '@',
- },
- link: function($scope) {
- $scope.iconImg;
- if ($scope.show == "opt1") {
- $scope.iconImg = "images/img1.png";
- } else if ($scope.show == "opt2") {
- $scope.iconImg = "images/img2.png";
- } else if ($scope.show == "opt3") {
- $scope.iconImg = "images/img3.png";
- } else if ($scope.show == "opt4") {
- $scope.iconImg = "images/img4.png";
- }
- }
- }
- });
- <img ng-if="show" ng-src="{{iconImg}}" class="list-image">
- <list-img show="{{item.opt1 ? 'opt1' : ''}}"></list-img>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement