I've recently started picking up angular2 and I'm developing a simple navegation web app. I want to press an option in a nav-menu and a div will update with a diferent html file as the user chooses.
I'm having trouble with the last part.
This is my page layout:
+-----------------------------------------------------------+
| header |
+-----------------+-----------------------------------------+
| | |
| | my-content-area |
| menu | |
| | |
| | |
+-----------------+-----------------------------------------+
| footer |
+-----------------------------------------------------------+
I've got the click event updating correctly, however I'm having touble with the templateUrl, as I can't get it to be dyanmic and the answers I keep finding are very complicated to the simple design I have (I want to keep this as simple as possible).
This is my nav-details.component.ts
:
import { Component, Input } from '@angular/core';
import { NavOption } from './nav.option';
@Component({
moduleId: module.id,
selector: 'my-content-area',
templateUrl: '{{ navoption.view_name }}'
})
export class NavDetailComponent {
@Input()
navoption: NavOption;
}
This does not work, as I get a 404 error saying that the file {{ navoption.view_name }}
can't be found instead of the value of the variable with the path name.