GithubHelp home page GithubHelp logo

joelkesler / angular-share-objects-instead-of-values Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 10 KB

Passing Objects vs Passing Values for sharing data between children and parent components in Angular

Home Page: https://stackblitz.com/edit/angular-ivy-aqinhv

CSS 1.06% HTML 34.01% TypeScript 64.93%

angular-share-objects-instead-of-values's Introduction

Passing Objects vs Passing Values for sharing data between children and parent components in Angular

From a Vendasta internal tech demo.

Try on StackBlitz ⚡️

When you pass an object as an input to a component, it's used as a reference/pointer to the original object. Any change you make to that object in a child component are shared between everything using that object.

If you pass in a bare value/variable (string, number, boolean, etc) then the value is duplicated, and changes made by a child component are not shared with anything else using that value/variable.

In the Angular Email Builder I used this to keep the main email data object updated when the user edited the email.

angular-share-objects-instead-of-values's People

Contributors

joelkesler avatar

Watchers

 avatar  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.