Reputation: 383
Hi inside the (Link) directive html not working
I am created (href, icon) directives (common directives), here values are coming based on the conditions (if), but Testing not bind the setValues(templates).
var app = angular.module('testApp', []);
app.directive('comonLink', ['$http', function($http) {
return {
restrict: 'AEC',
require: '',
scope: {
setValues:'@',
},
template:'<div > {{ setValues }} </div>',
link: function(scope, iElement, iAttrs, ngModelController) {
var comonLink=iAttrs.comonLink;
var splitValues=comonLink.split(",");
if(splitValues[0]=='link'){
scope.setValues="<a href=''> Testing </a>";
}
}
};
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body data-ng-app="testApp" >
<div class="wrapper">
<span comon-Link="link,add,icon"></span>
</body>
Upvotes: 2
Views: 41
Reputation: 940
In your html is a fault, you can't use uppercase, it should be
<span comon-link="link,add,icon"> </span>
Upvotes: 1