Giter Club home page Giter Club logo

angular_parent_child_method_calling's Introduction

@ceejay15 11/19/2016

angular_parent_child_method_calling

Sample of Parent calling child component's method

Description: This is just a demonstration on how Parent Component can call Child's Component method using Angular2's @ViewChild. To know more about component communication, you can follow their guide at angular.io at https://angular.io/docs/ts/latest/cookbook/component-communication

Problem: 1.) When user clicks a 'Launch A Form' button it should display tab two and also show a form as the content but it is not showing. User needs to trigger the child component's method that handles click event before it showed the form.

Solution: Must be able to call child method from parent and make the tab 2 appear along with its content. Using @Viewchild making parent's component communicate to child component's method.

Expected flow of this plunker after solving the problem

  1. Tab two must only be available when user clicks 'Launch A Form'
  2. When user clicks 'Submit and Close' button on tab two's form, it will unload the form and remove tab two from the screen.

NOTE:Code here is not the actual code and just a sample on how it solved my problem.

angular_parent_child_method_calling's People

Contributors

ceejay15 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.