I m actually making the angular.io quickstart and I need now to split my component into different files.
The problem is that I dont know at all how to do it, and it's not explained in the dev preview doc.
Can you help ?
I simply have two components (the main in app.js, and another one which only list informations)
Thanks for advance
Agree, this is not well explained and a lot of examples only use a single component or components in a single file. This is an example I am building which uses (currently) 2 components in separate files and is about as simple as I can make it...
https://github.com/mdausmann/angular2-canvas
Essentially, you need to export the sub-component from it's module...
export default NoteComponent;
and import it into the composing or parent module...
import NoteComponent from "note";
Oh, this import/export thing is ES6 module syntax, great ref here
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With