1

How would the syntax look for calling two methods inside the ng-click control.

HTML

ng-click="submitForm(M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15), postComments(comment)">

I tried it with a comma and without one.

Error

Error: [$parse:syntax] Syntax Error: Token ',' is an unexpected token at column 77 of the expression [submitForm(M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15), postComments(comment)] starting at [, postComments(comment)].
http://errors.angularjs.org/1.4.3/$parse/syntax?p0=%2C&p1=is%20an%20unexpected%20token&p2=77&p3=submitForm(M1%2C%20M2%2C%20M3%2C%20M4%2C%20M5%2C%20M6%2C%20M7%2C%20M8%2C%20M9%2C%20M10%2C%20M11%2C%20M12%2C%20M13%2C%20M14%2C%20M15)%2C%20postComments(comment)&p4=%2C%20postComments(comment)
    at REGEX_STRING_REGEXP (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8895:12)
    at Object.AST.throwError (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21708:11)
    at Object.AST.ast (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21478:12)
    at Object.ASTCompiler.compile (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21927:31)
    at Parser.parse (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22776:29)
    at $parse (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22900:39)
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:57510:7
    at IonicModule.config.factory.directive.directive.restrict (http://localhost:8100/lib/ionic/js/ionic.bundle.js:57526:5)
    at invokeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:17477:9)
    at nodeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16977:11) <ion-item class="item-balanced item item-complex" href="#/app/checklist" value="submit" ng-click="submitForm(M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15), postComments(comment)">
1
  • 1
    add semicolon instead of comma Commented Sep 3, 2015 at 9:03

1 Answer 1

2

You need to put a ; (semicolon), instead of , (comma) between function calls

ng-click="submitForm(M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15); postComments(comment)">
Sign up to request clarification or add additional context in comments.

1 Comment

Yeah thanks! didn't thought of that?? Will accept your answer as soon as I am allowed. :)

Your Answer

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