-1

Angular NgModel Does Not Work At All: Object(...) is not a function

Even just having ngModel on an input was crushing my runtime. Did I remember to import the FormsModule? Yes. Having #form="ngForm" on my <form> wasn't a problem. Very frustrating -- wasted so much time.

Here's the Error

ERROR TypeError: Object(...) is not a function
    at _isAndroid (VM19326 taskpane.js:62091)
    at new DefaultValueAccessor (VM19326 taskpane.js:62144)
    at createClass (VM19326 taskpane.js:55008)
    at createDirectiveInstance (VM19326 taskpane.js:54849)
    at createViewNodes (VM19326 taskpane.js:56307)
    at callViewAction (VM19326 taskpane.js:56741)
    at execComponentViewsAction (VM19326 taskpane.js:56650)
    at createViewNodes (VM19326 taskpane.js:56335)
    at createEmbeddedView (VM19326 taskpane.js:56184)
    at callWithDebugContext (VM19326 taskpane.js:57621)

1 Answer 1

0

Answer

After searching high and low, I came across this issue which pointed me to look at my package.json. I didn't see anything related to the issue there, but what I did notice was that I had installed @angular/[email protected] when all of my other Angular versions were ^5.2.9. This is because I installed the npm package manually because I'm working on a Microsoft Word "Add-Ins" app -- and the Word CLI / Yeoman does not install @angular/forms for you. This led to a mismatch, which I'm sure can happen in any environment.

TL;DR

package.json
"@angular/core": "^5.2.9",
"@angular/forms": "^10.n.n"
Sign up to request clarification or add additional context in comments.

Comments

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.