Topic: Angular 4 ngModel binding not work?
                                html:
                                                                
                                
                                                                                                                                                    
                                        
                                
                            
                                                                                <input type="text" class="form-control" id="topicId" [(ngModel)]="testStr" mdbActive>ts:
testStr = '';I tried many ways to get a two-way binding, not work. Seems Mdb not support Angular 4 ngModel yet?
                                                                                            Add comment
                                                                                    
                                                                    
                                                    
                                                    Chen Xiao
                                             pro                                             answered 8 years ago                                        
Sorry, my fault.
To use ngModel, should import FormsModule first.
app.module.ts
...
import { FormsModule } from '@angular/forms';
...
imports: [
 FormsModule,
...
html:
... <input type="text" class="form-control" id="topicId" [(ngModel)]="comic.topic" name="topic" mdbActive> ...
Everything is ok!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
                            
                            Resolved
Specification of the issue
                                            
        - User: Pro
 - Premium support: No
 - Technology: MDB Angular
 - MDB Version: -
 - Device: -
 - Browser: -
 - OS: -
 - Provided sample code: Yes
 - Provided link: No