Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '$$notifyModelModifiedStateChanged' of null #45

Closed
olegkoskin opened this issue Sep 9, 2016 · 2 comments

Comments

@olegkoskin
Copy link

olegkoskin commented Sep 9, 2016

Hi!

I have some legacy system and I got a problem with this midule. There is the form

<form novalidate name="studyDesignDetailForm" ng-init="initializeForm()" class="form-horizontal"
                  role="form" data-disable-all="readOnly">
    <label>Label_1</label>
    <input name="sDesignName" type="text" maxlength="255" ng-model="studyDesign.studyDesignName"
           class="form-control input-sm" ng-readonly="!isStudyActive"/>

    <label>Label_2</label>
    <input type="text" name="overdueDays" class="form-control input-sm"
           ng-pattern="numericPattern"
           onkeypress='return event.charCode >= 48 && event.charCode <= 57' maxlength="4"
           ng-model="currentTimePoint.overdueDays "
           ng-disabled="currentTimePoint.scheduled=='N'?true:false" ng-required="currentTimePoint.scheduled=='N'?false:true && !readOnly"/>
</form>

For 2nd input I get exception:

TypeError: Cannot read property '$$notifyModelModifiedStateChanged' of null
    at angular-input-modified.js:386
    at angular.js:19612
    at completeOutstandingRequest (angular.js:5964)
    at angular.js:6243

'cause when ngInputModified's ngModel directive is executing the form in null. In ngModelModifiedFactory

  // Handling controllers.
  var modelCtrl = controllers[0];    // ModelController
  var formCtrl = controllers[1];     // null
  var bsModifiable = controllers[2]; // null

Do you have any idea what's go wrong?

@slavafomin
Copy link
Member

Hello! Thank you for your interest in this module!

Please create a Plunk with isolated use case. You could fork our Plunk, to get you started.

@slavafomin
Copy link
Member

From the top of my head:

  1. Why are you using ng-init to initialize the form? Can't you do this right away in the controller? If you need to resolve something - it's good idea to do it in router's resolve.
  2. If you need to show the form conditionally, consider hiding it inside of ng-if to prevent directives from execution until the form is ready or abstract it away to it's own directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants