betsol / angular-input-modified

Angular.js module to detect and indicate input modifications
90 stars 35 forks source link

regarding the modal #26

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello, I need to know is there any way to use dirty check on modal instead of the form name element. If yes can you please write me the simple example. And I have also one custom dropdown in my form. Which is not there the name attributes on my html how can I track this. I have past my html in the below mail. Can you please see the below html and provide me the function in my JavaScript to check the dirty flag

Field Details

{{acreage.toFixed(2)}} {{fieldUnit | uppercase}}
Current Season ({{seasonsName[0].substr(0,4)}} / {{seasonsName[0].substr(5)}})
Previous Season ({{seasonsName[1].substr(0,4)}} / {{seasonsName[1].substr(5)}})
RTP-{{varietyDetailP01.rtp}} ; RTN-{{varietyDetailP01.rtn}} ; RTCC-{{varietyDetailP01.rtcc}}
RTP-{{varietyDetailP02.rtp}} ; RTN-{{varietyDetailP02.rtn}} ; RTCC-{{varietyDetailP02.rtcc}}
RTP-{{varietyDetailP11.rtp}} ; RTN-{{varietyDetailP11.rtn}} ; RTCC-{{varietyDetailP11.rtcc}}
RTP-{{varietyDetailP12.rtp}} ; RTN-{{varietyDetailP12.rtn}} ; RTCC-{{varietyDetailP12.rtcc}}
{{seasonsName[2].substr(0,4)}} / {{seasonsName[2].substr(5)}} Season
{{seasonsName[3].substr(0,4)}} / {{seasonsName[3].substr(5)}} Season
{{seasonsName[4].substr(0,4)}} / {{seasonsName[4].substr(5)}} Season
slavafomin commented 9 years ago

Hello @vikasmundra. Thank you for your interest in the library.

What do you mean by doing "dirty check on modal"? Dirty state of the ngModel or ngForm can be checked using Angular's $dirty/$pristine properties, input-modified has nothing to do with this.

Every element that you want to "track" using input-modified should have a correct name property. Otherwise you will not be able to fetch it using $scope.formName.fieldName notation. However, maybe you will be able to retrieve the controller using this suggestion: https://groups.google.com/forum/#!topic/angular/BZqs4TXyOcw. I'm not tried it and I don't know if it's a public API though. Maybe you should find a way to specify name for the underlying input field of the used directive. if not possible consider to file an issue for that module.

The issues here on GitHub is primarily for solving problems with the library itself. If you need additional help with your project — I'm providing consulting services on a commercial basis. Feel free to contact me by E-Mail for this: s.fomin@betsol.ru.

Cheers!