Skip to main content

Posts

Showing posts with the label angular5

Can't bind to 'formGroup' since it isn't a known property of 'form'

ERROR: Can't bind to 'formGroup' since it isn't a known property of 'form' Solution : To fix this error, you just need to import ReactiveFormsModule from @angular/forms in your module. Here's the example of a basic module with ReactiveFormsModule import: import { NgModule } from '@angular/core' ; import { BrowserModule } from '@angular/platform-browser' ; import { FormsModule, ReactiveFormsModule } from '@angular/forms' ; import { AppComponent } from './app.component' ; @ NgModule({ imports: [ BrowserModule, FormsModule, ReactiveFormsModule ], declarations: [ AppComponent ], bootstrap: [AppComponent] }) export class AppModule { }

Create a new component in angular

If you are Not aware of basis environment set up and Hello world of angular please go through below links for the context. 1 .  angular-4/5/6-set-up-environment 2 .  angular-5-hello-world-step-by-step Above links help us in creating ready made application which angular CLI provide us but now we want a component of our own. Step 1:    Creating a Custom Component navigate to your folder structure where you want to create your custom component and then run below command ng g component customHelloWorld like this : D:\Rakesh_kumar_Singhania\Angular5HelloWorld\hello-world-app\src\app> ng g component customHelloWorld This command will create your component and also it make sure to mark an entry in your app.module.ts file. app.module.ts -- This file holds all the source required by the project which include all the imports of the components. below is the snapshot of generated files : Beauty of command  ng g component customHell...

Angular 5 Hello world step by step

Step 1: Prerequisites Install Node.js & npm Angular 4/5/6 set up environment Install Angular CLI Creating a new Angular app is a bit tedious job especially when you are new to Typescript as there will be lot of initial configurations involved. In order make it simpler Google came up with the utility called Angular CLI, using which we can create and manage our app from command line itself In order to install Angular CLI open Node.js command prompt/command prompt and run the below command npm install - g @angular / cli Install Code Editor There are multiple code editors available in market 1. Microsoft Visual Code Studio 2. Brackets 3. Notepad++, 4. Sublime Text As I m Fond of eclipse so I have installed angular plugin in eclipse as Angular editor. Step 2: Create Project Lets build our First Angular 5 Hello World application Create a new folder with folder name “Angular5HelloWorld” anywhere you want. Open command prompt and navigate to the fold...