Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting errors :(
Message
 
 
À
11/08/2017 05:20:59
Information générale
Forum:
AngularJS
Catégorie:
Compilation
Divers
Thread ID:
01653229
Message ID:
01653246
Vues:
83
This is an exact error:
angular.js:14525 [TypeError: Cannot create property 'value' on string '']
    at Object.fn.assign (eval at compile (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:15358:15), <anonymous>:4:519)
    at Object.$$writeModelToScope (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28810:10)
    at writeToModelIfNeeded (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28804:14)
    at http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28798:9
    at validationDone (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28723:9)
    at processAsyncValidators (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28706:9)
    at Object.$$runValidators (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28650:5)
    at Object.$$parseAndValidate (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28791:10)
    at Object.$commitViewValue (http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28757:10)
    at http://siriuswarecontrol.web/SiriuswareControl/Scripts/angular.js:28898:14
It happens when I try to type something in the input for the second time (the first time everything works fine). The second time after the very first keystroke I got that error.

This is how the input looks like in the HTML template:
<div class="col-xs-12 m-t-input" ng-show="canShowInput">
                    @*ng-switch creates its own scope, so we need to add $parent to the ng-model*@
                    <select ng-if="field.strInputSource === 'DropDownList'" 
                            class="form-control" ng-disabled="!field" ng-model="$parent.val">
                        <option value="" ng-selected="selected">@Labels.select</option>
                        <option ng-repeat="val in field.possibleValues" value="{{val}}">{{val.value}}</option>
                    </select>
                    <select ng-if="field.strInputSource === 'Boolean'" class="form-control" 
                            ng-disabled="!field" ng-init="$parent.val.value='true'" ng-model="$parent.val.value">
                        <option value="true" ng-selected="selected">@Labels.trueLabel</option>
                        <option value="false">@Labels.falseLabel</option>
                    </select>
                    <input class="form-control" ng-if="field.strInputSource === 'FreeForm'" 
                           type="text" ng-model="$parent.val.value" ng-required="isFreeFormRequired" 
                           id="advanced-search" name="advancedSearch"/>
                    <p class="input-group" ng-if="field.strInputSource === 'Calendar'">
                        <data-sm:date-time-picker ng-model="$parent.val"
                                                  is-date-range="false"
                                                  pick-time="false"
                                                  is-required="true"
                                                  show-bod="false"
                                                  show-eod="false"
                                                  show-now="false"
                                                  form="advancedSearchForm"
                                                  name="searchDate">
                        </data-sm:date-time-picker>                        
                    </p>
                </div>
I think something may be bad with the model here ($parent.val.value - sounds weird). I'll investigate.

Also, perhaps this is a good idea to use controller as syntax, I may consult with my colleague. In this case we would not need to use $parent which is a bad practice.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform