Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Angular 2 Architecture

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 350
    Comment on it

    Angular 2 architecture consists of module , component , template , metadat , data binding , service , directive and dependency injection.Some of them are :

    1. Module
    2. Component
    3. Template
    4. Metadata

    Module:

    A module is a block of code that is used to perform a single task. We can build our application using these modules. Component class can be exported from a module. We can use the export statement to export the component class from the module.

    export class TestComponent { }

    The export statement tells us that this is a module and its TestComponent class is defined as public and it can be accessible by other modules of the application.

    Component:

    A Component is a basic building block for angularJS application.It is simply "a part of the web page" .

    Template:

    This tells the angular how to display the component.

    <div>
     The name is : {{name}}
    </div>

    We put the template expression inside the interpolation braces to display it is value.

    Metadata:

    It is a way of processing a class.Suppose we have a component name TestComponent which will be treated as a class until we tell the Angular that it is a component. For this purpose, we can use metadata to tell the angular that TestComponent is a component. Metadata is attached to typescript using the decorator.

    @Component({
       selector : 'testlist',
       template : '<h2>Name is Rahul</h2>'
       directives : [TestComponent]
    })
    export class TestComponent{ }

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: