javascript - fnPtr is not a function when adding element to array in AngularJS -
i'm having trouble.
i have checkbox, when checkbox checked want load 3 objects array, when happens see error occurs 6 times:
error: fnptr not function parser.prototype.functioncall/<@http://localhost:8383/myapp/js/angular.js:10568:15 operators["==="].... error: fnptr not function parser.prototype.functioncall/<@http://localhost:8383/myapp/js/angular.js:10568:15 operators[">"]....
what i'm doing wrong?
this code:
html:
<div class="form-group col-sm-12 subject-field"> <label>has children?</label> <input type="checkbox" ng-model="marriage.has_children" ng-change="setsons()" title="if had children check box"> </div> <div class="col-sm-12 col-md-12" ng-repeat="littleboy in marriage.children"> <h3>{{$index+1}}</h3> ... </div>
controller:
angular.module('dexpress').controller('formcontroller',['$scope', '$filter', '$http', '$log', function($scope, $filter, $http, $log) { $scope.marriage = { lives_togheter: false, has_children: false, celebration_date: $filter('date')(new date(), 'dd-mm-yyyy'), separation_time: 0, another_information: "", state: "montevideo", city: "montevideo", country: "uruguay", children: [] }; $scope.addson = function(){ var person = { name: "", surname: "", birth_date: $scope.today, studies: false, where_studies: "school...", year_of_study: "1st grade", is_disabled: false, explanation: "" }; $scope.marriage.children.push(person); }; $scope.setsons = function(){ if($scope.marriage.has_children){ $scope.marriage.children=[]; $scope.addson(); $scope.addson(); }else{ $scope.marriage.children = []; } }; }
Comments
Post a Comment