In html:
<cms-text required="false" id="product_name" thename="product_name"></cms-text>
In cmsText.js
angular.module('cmsText',[]).directive('cmsText', function(){
'use strict';
return {
restrict: 'EA',
scope: {
thename:'=',
required:'=',
id:'='
},
replace:true,
templateUrl: 'cms-text/cmsText.html',
};
});
In cmsText.html
<input id="id" class="form-control" name="thename" type="text" required>
I want the "required" word in input tag shows only when it is set to true and the word disappear when it is set to false. Anyone could help?