小编Sil*_*ito的帖子

Cannot assign to a reference or variable (ngModel with custom component)

I am trying to set the ngModel from my custom component, but I am receiving an error message. I need to add the support to Two Way DataBind on this component.

I tried to use this tutorial:

https://thiagomelin.com.br/2017/08/09/angular-2-criando-um-custom-component-com-ngmodel/

The loop code (The collection.bookmark is an empty array in this test)

<div *ngFor="let b of collection.bookmark">
        <app-telephonist-control [(ngModel)]="b"></app-telephonist-control>
        <pre>{{ b | json}}</pre>
      </div>
Run Code Online (Sandbox Code Playgroud)

The code of component

import { Component, OnInit, Input, Output, EventEmitter, forwardRef } from '@angular/core';
import { NG_VALUE_ACCESSOR, …
Run Code Online (Sandbox Code Playgroud)

components angular

2
推荐指数
1
解决办法
3169
查看次数

标签 统计

angular ×1

components ×1