Day 15 : Simple Angular UI

     As we discussed before the angular concepts.....using that now we are going to build a simple app.....

  • Angular contains the components to build a application :
  1.  A component class handles data and functionality.
  2. An HTML template determines the UI of application.
  3. Specific styles in component defines the looks and styles of application.
  • As we are created the application file earlier for HospitalManagement we are updating their further....
Create a folder :
  • Create a new file in HospitalManagement/EMR/src/app as app.model.ts.

app.model.ts :
  • We have created this new file.
  • We have to import this file in appComponent so we have to export this so that we can use the declarations.
  • An array stores multiple values as we all know, here we have declared array with genric type i.e  Array<element type>.
  • For now we are not going to see the array.....in upcoming blogs we are going to learn this. 
                                       


app.module.ts :
  • This is the root module of angular files, it organizes and separates your code.
  • We can import any other module in 'imports', as i have imported FormsModule which is not their at start. If you not import this FormsModule you can get error like "Can't bind to 'ngModel' since it isn't a known property of 'input' " .
  • We can declare components in 'declarations' , any component used in routing in that module must declared in this section.
  • We provide services in 'providers' section.
  • One thing which i have also get confused here we use 'NgModule' as a component and at binding side we use 'ngModule'.


app.component.ts :
  • Here we import the Patient class from app.model.ts.
  • The Components are defined using @Component decorator, it contains selector, template, style and other required properties.
  • This specifies the metadata required to process the component.
  • Here we created the object of Patient and Array<element> .
  • The this.patientObjs is used to store show the entered data and this.patientObj is used to clear the block.



app.component.html :
  • Angular is a framework which allows us to create "Single Page Applications". Here we write the basic HTML code.
  • This file shows the component view.

Output :
Whenever we type in the block the same will be shown below the add button and when we click Add button it will updated/added in the table below.



For more understanding watch below video :


Thank You!!!

Comments

Popular posts from this blog

Day 3 : JavaScript

SQL Concepts-1

ASP .NET Session Management