angular - Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (" -


i learning angular scratch , new. please forgive me if question simple. have done research solutions did not work me. have app.component.html contains below code:

<!--the content below placeholder , can replaced.--> import { formsmodule } '@angular/forms'; import { domsanitizer} '@angular/platform-browser' import { safehtml } '@angular/platform-browser'  <input type="text" [(ngmodel)] = "name"> <p>{{ name }}</p> // have tried {{ '{' }} name {{'}'} suggested in other forums.  

then have app.component.ts file contains:

import { component } '@angular/core';  @component({   selector: 'app-root',   templateurl: './app.component.html',   styleurls: ['./app.component.css'] }) export class appcomponent {   name = '' ; } 

i using angular cli handle building code. not sure why below error.

compiler.es5.js:1690 uncaught error: template parse errors: unexpected character "eof" (do have unescaped "{" in template? use "{{ '{' }}") escape it.) ("  <input type="text" [(ngmodel)] = "name"> <p>{{ name }}</p> [error ->]"): ng:///appmodule/appcomponent.html@7:0 invalid icu message. missing '}'. ("  <input type="text" [(ngmodel)] = "name"> <p>{{ name }}</p>  [error ->]"): ng:///appmodule/appcomponent.html@7:0     @ syntaxerror (compiler.es5.js:1690)     @ directivenormalizer.webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizeloadedtemplate (compiler.es5.js:14128)     @ compiler.es5.js:14114     @ object.then (compiler.es5.js:1679)     @ directivenormalizer.webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizetemplateonly (compiler.es5.js:14114)     @ directivenormalizer.webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizetemplate (compiler.es5.js:14096)     @ compilemetadataresolver.webpackjsonp.../../../compiler/@angular/compiler.es5.js.compilemetadataresolver.loaddirectivemetadata (compiler.es5.js:15125)     @ compiler.es5.js:26802     @ array.foreach (<anonymous>)     @ compiler.es5.js:26801 syntaxerror @   compiler.es5.js:1690 webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizeloadedtemplate @   compiler.es5.js:14128 (anonymous) @   compiler.es5.js:14114    @   compiler.es5.js:1679 webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizetemplateonly   @   compiler.es5.js:14114 webpackjsonp.../../../compiler/@angular/compiler.es5.js.directivenormalizer.normalizetemplate   @   compiler.es5.js:14096 webpackjsonp.../../../compiler/@angular/compiler.es5.js.compilemetadataresolver.loaddirectivemetadata   @   compiler.es5.js:15125 (anonymous) @   compiler.es5.js:26802 (anonymous) @   compiler.es5.js:26801 webpackjsonp.../../../compiler/@angular/compiler.es5.js.jitcompiler._loadmodules    @   compiler.es5.js:26798 webpackjsonp.../../../compiler/@angular/compiler.es5.js.jitcompiler._compilemoduleandcomponents @   compiler.es5.js:26768 webpackjsonp.../../../compiler/@angular/compiler.es5.js.jitcompiler.compilemoduleasync  @   compiler.es5.js:26697 webpackjsonp.../../../core/@angular/core.es5.js.platformref_._bootstrapmodulewithzone   @   core.es5.js:4536 webpackjsonp.../../../core/@angular/core.es5.js.platformref_.bootstrapmodule    @   core.es5.js:4522 ../../../../../src/main.ts  @   main.ts:11 __webpack_require__ @   bootstrap ac0793c…:54 0   @   main.bundle.js:182 __webpack_require__ @   bootstrap ac0793c…:54 webpackjsonpcallback    @   bootstrap ac0793c…:25 (anonymous) 

i appreciate help. thank much

it's not escaping curly braces, based on vary low information have provided in question, have 1 of these cases:

  • unbalanced double curly braces
  • using statement not valid compiler

for latter should case, fix removing import statements template component.

edit:

to more specific, have statements this:

import { formsmodule } '@angular/forms'; 

in template, compiler import simple text , sees first { , formsmodule. now, compiler expects { based on best match finds. so, have mixture of both, using statement has no meaning in context of template , based on have unbalanced curly braces.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -