I am creating a directive, in which i want to compare the value stored in a model (say "name" as model and it is having value "Angular") to be stored in a variable.
I tried something like below,
var nameValue=name;
but it(nameValue) is not having the value "Angular"
Example:
app.directive('kmRadio', function() {
return{
restrict:'E',
compile: function(element,attrs) {
var model=ngModelName;
console.info(attrs.kmModel);
console.info("{{'+attrs.kmModel+'}}");
if(attrs.kmTitle==model) {
previewString="<input type="+"radio"+" checked>";
}
else {
previewString="<input type="+"radio"+">";
}
var htmlText=''+previewString+''+
element.replaceWith(htmlText);
}
}
})
Can anyone tell me how to retrieve the value stored in model(ng-model)