I am using angularjs in a project and in which I am using ng-options for generating .
Initially when the pages reload and no option element is selected the html gene
The solution above will corrupt the model with junk data. Please use the directive to reset the model in the right way JS: Select Option
Directive"
.directive('dropDown', function($filter) {
return {
require: 'ngModel',
priority: 100,
link: function(scope, element, attr, ngModel) {
function parse(value) {
if (value) {
if(value === "")
{
return "crap"
}
else
{
return value;
}
} else {
return;
}
}
ngModel.$parsers.push(parse);
}
};
});