In my form I have an ng-repeat and within that ng-repeat I have a bunch of fields. Sometimes there could be 3 fields, sometimes there might just be one.
I have an angular for each to check $pristine for a specific field. The name of the field pretty much stays the same but the field count number changes so I thought I would check it like this:
var price = "price_" + product.line_no;
console.log($scope.myform.price.$pristine); = console.log($scope.myform."price_1".$pristine);
But I am getting this:
TypeError: Cannot read property '$pristine' of undefined
pricevariable as an input name but i'm not sure why this is.Even though it is being populated asprice_1$scope.myform.price? In your code, you only defined a string variable called priceconsole.log($scope.myform.price_1.$pristine)it returns a value but if I set a variable with the field name and the line number and use it withinconsole.log($scope.myform.price.$pristine)it breaks it.