Closed CoreyCole closed 7 years ago
Also
src/app/app.module.ts
in the declarations array when it doesn't do the same for pages?...
mean before the passed parameter components
mean in test.ts
? Is this some sort of way to assign an array in Typescript?
public static configureIonicTestingModule(components: Array<any>): typeof TestBed {
return TestBed.configureTestingModule({
declarations: [
...components,
]
Sorry for all these questions at once. I hope they're not too uninformed.
Hey Corey,
You'll get quicker (and better) general programming answers on stack overflow. But I am happy enough to point you at documentation.
1 - What is the purpose of src/components/components.module.ts
It is an angular 2 module for the components in clicker: https://angular.io/docs/ts/latest/guide/ngmodule.html
2 - Also, while I'm asking, what is the purpose of src/components/index.ts?
It is a barrel, it allows easier imports. Barrels were more relevant pre-modules. https://basarat.gitbooks.io/typescript/docs/tips/barrel.html
3 - do you suggest not using the ionic-cli at all?
Use it for everything it is capable of doing. Ionic don't support testing at all, so you need to use ng-cli for that
4 - I noticed that your pages don't have "Page" appended as a suffix
Pages are just components in angular 2, they used to be different (Ionic used to have an @Page annotation), but they don't anymore. Where possible, my code follows the angular 2 style guide: https://angular.io/styleguide
5 - why does ionic-cli automatically add components to src/app/app.module.ts in the declarations array when it doesn't do the same for pages?
No idea - a question for Ionic?
6 - what does ... mean
It expands the array: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Spread_operator
Thanks
I'm trying to model my ionic project after this one and I'm trying to understand every piece of it.
What is the purpose of
src/components/components.module.ts
? Ionic doesn't generate this automatically when creating components and I'm wondering what it's used for.Also, while I'm asking, what is the purpose of
src/components/index.ts
?Thanks so much for making this repository lathonez, it's been helping my team a lot. Also thanks to anyone who answers my questions :)