Pasvaz/bindonce

bindonceController.runBinders is not a function

jeffward01 opened this issue · 2 comments

I am testing this library to speed up my large Angular 1.3.5 application. I installed Bindonce and was able to get it to run, now when the page loads (it does load) i get many errors in the console. All of the errors say:

TypeError: bindonceController.runBinders is not a function
at bindonceDirective.link (http://spa.local/scripts/bindonce.js:225:26)
at invokeLinkFn (http://spa.local/scripts/angular.js:8141:9)
at nodeLinkFn (http://spa.local/scripts/angular.js:7653:11)
at compositeLinkFn (http://spa.local/scripts/angular.js:7009:13)
at publicLinkFn (http://spa.local/scripts/angular.js:6888:30)
at boundTranscludeFn (http://spa.local/scripts/angular.js:7027:16)
at controllersBoundTransclude (http://spa.local/scripts/angular.js:7680:18)
at ngRepeatAction (http://spa.local/scripts/angular.js:24406:15)
at Object.$watchCollectionAction as fn
at Scope.$digest (http://spa.local/scripts/angular.js:14133:29)

Please advise? Thanks! And thanks for writing this library, i am telling all my friends about it.

I read this on your docs:

when used with ng-repeat bindonce doesn't need to check if person is defined because ng-repeat creates the directives only when person exists. You could be more explicit:

  • , however assigning a value to bindonce in an ng-repeat won't make any difference.

    So I dont think i am making a mistake by doing this:

    <tbody bindonce ng-repeat="licenseNote in licenseDetail.licenseNoteList">
                    <tr>
                        <td securityreadonlyhide class="one-percent centered"><input type="checkbox" ng-model="licenseNote.selected" bindonce bo-if="licenseNote.displayNote" /></td>
                        <td class="eight-percent">{{licenseNote.createdDate | timezone | date:'MM/dd/yyyy' }}</td>
                        <td class="eight-percent">{{licenseNote.noteType.noteType}}</td>
                        <td class="eight-percent">{{licenseNote.contact.fullName}}</td>
                        <td class="seventyfive-percent" style="white-space: pre-wrap;">{{licenseNote.note }}</td>
    
                    </tr>
    

    instead of this:

    <tbody bindonce="licenseDetail.licenseNoteList" ng-repeat="licenseNote in licenseDetail.licenseNoteList">
                    <tr>
                        <td securityreadonlyhide class="one-percent centered"><input type="checkbox" ng-model="licenseNote.selected" bindonce bo-if="licenseNote.displayNote" /></td>
                        <td class="eight-percent">{{licenseNote.createdDate | timezone | date:'MM/dd/yyyy' }}</td>
                        <td class="eight-percent">{{licenseNote.noteType.noteType}}</td>
                        <td class="eight-percent">{{licenseNote.contact.fullName}}</td>
                        <td class="seventyfive-percent" style="white-space: pre-wrap;">{{licenseNote.note }}</td>
    
                    </tr>
    

    ****Difference ^^^ (bindonce="licenseDetail.licenseNoteList) ^^^

  • I also get this error:

    TypeError: bindonceController.setupWatcher is not a function
    at bindonceDirective.link (http://spa.local/scripts/bindonce.js:230:25)
    at invokeLinkFn (http://spa.local/scripts/angular.js:8141:9)
    at nodeLinkFn (http://spa.local/scripts/angular.js:7653:11)
    at compositeLinkFn (http://spa.local/scripts/angular.js:7009:13)
    at compositeLinkFn (http://spa.local/scripts/angular.js:7012:13)
    at compositeLinkFn (http://spa.local/scripts/angular.js:7012:13)
    at compositeLinkFn (http://spa.local/scripts/angular.js:7012:13)
    at publicLinkFn (http://spa.local/scripts/angular.js:6888:30)
    at http://spa.local/scripts/angular-ui-router.min.js:7:22101
    at invokeLinkFn (http://spa.local/scripts/angular.js:8141:9)

    Example:

       <div bindonce="config">
                        <tr ng-repeat="config in productDetail.configurations">
                            <td>
                                <span class="icon config-physical" ng-class="config.configuration.id | returnConfigurationIcon"></span>{{config.configuration.name}}
                            </td>
                            <td> {{config.upc}}</td>
                            <!--<td class="twenty-percent">{{config.record_number}}</td>-->
    
                            <td class="centered">{{config.releaseDate | timezone | date:'MM/dd/yyyy'}}</td>
                        </tr>
                    </div>