解析错误:意外的角色Angular 4

时间:2018-01-12 22:45:17

标签: angular

我有一个这样的对象:

persona = {
...
edadNiño = 9
}

我希望像这样绑定它:

<input type="number"  name="edadNiño" [(ngModel)] = "persona.edadNiño">

但我收到错误:

compiler.es5.js:1694 Uncaught Error: Template parse errors:
Parser Error: Unexpected token 'Lexer Error: Unexpected character [ñ] at 
column 77 in expression [persona.edadNiño]'

有谁知道如何解决这个问题? 谢谢! :d

2 个答案:

答案 0 :(得分:0)

尝试使用以下代码替换你的组件代码因为我觉得一个特殊的字符'〜'会导致你的问题

persona = {
      edadNino = 9
    }

在HTML中只需执行以下操作

<input type="number"  name="edadNino" [(ngModel)] = "persona.edadNino">

答案 1 :(得分:0)

我会将HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost postRequest = new HttpPost("https://showcase.example.com/show/send"); StringEntity input = new StringEntity("{\"data\":{\"detail\":\"this is detail\",\"title\":\"Hello World\"}}"); input.setContentType("application/json"); postRequest.addHeader("Authorization", "key=LKAJLKJlkajsdgjalgj"); postRequest.setEntity(input); HttpResponse response = httpClient.execute(postRequest); 替换为ñ中的n

看起来非UTF字符存在未解决的问题: https://github.com/angular/angular/issues/517

相关问题