আমি কৌণিক 2 নিয়ন্ত্রণের জন্য দ্বি-মুখী বন্ধন পরীক্ষা করার চেষ্টা করছি input
। ত্রুটি এখানে:
Can't bind to 'ngModel' since it isn't a known property of 'input'.
App.componal.html
<input id="name" type="text" [(ngModel)]="name" />
<div id="divName">{{name}}</div>
App.componal.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
name: string;
}
app.componal.spec.ts
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { AppService } from './app.service';
describe('App: Cli', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers:[AppService]
});
});
it('divName', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let comp = fixture.componentInstance;
comp.name = 'test';
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('divName').textContent).toContain('test');
}));
});