Usually, when I wrote pages which I know I’m not gonna include in other components (let’s say root pages or full pages), I didn’t add the selector attribute. Most of my pages look like
@Component({
templateUrl: 'todo.html'
})
Is that a bad practice? Is it better to always specify selector?
If you have a parent component with an object, and you use a selector to display a child component, you can pass the object to the child component this way in Angular 2:
In the parent.html <child-component [nameOfObjectInsideChildComponent] = "nameOfObjectInsideParentComponent"></child-component>
Then in child.ts @Input nameOfObjectInsideChildComponent: any;
But in Ionic 2, I’m having problems getting the object in the child component. I get no errors but my object is undefined. Maybe in Ionic this is done in a different way?