1

I'm having this trouble.

I have a checkbox, when the checkbox is checked I want to load 3 objects into an array, but when it happens I see this error that occurs six times:

Error: fnPtr is not a function Parser.prototype.functionCall/<@http://localhost:8383/MyApp/js/angular.js:10568:15 OPERATORS["==="].... Error: fnPtr is not a function Parser.prototype.functionCall/<@http://localhost:8383/MyApp/js/angular.js:10568:15 OPERATORS[">"]....

What I'm doing wrong?

This is my 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 the 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 = [];
                 }        
        };


    }
4
  • is $scope.marriage.children available straight away or it doesn't exist until it is set by setSons? Commented Jun 29, 2015 at 15:42
  • This might be related also hard to find out without seeing the contextual source code. Commented Jun 29, 2015 at 15:45
  • I edited the question adding the controller code Commented Jun 29, 2015 at 15:48
  • I have the same problem, except the error have OPERATORS["&&"] Commented Aug 4, 2015 at 8:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.