Uso del archivo html como plantilla para el componente en angular 2
Tengo la siguiente estructura de la aplicación
app
home
home.html
home.ts
home.sass
app.component.ts
index.html
Esencialmente quiero dividir mis páginas en carpetas separadas que tienen estilo, .ts y .archivos html relacionados con ellos
Sin embargo, en este momento cargando una plantilla como esta
import {Component} from 'angular2/core';
@Component({
selector: 'admin-app',
template: 'home/home.html'
})
export class AppComponent { }
Cargas literarias " home / home.html " string como una plantilla donde como quiero contenidos html de la casa.archivo html.
37
Author: Sangwin Gawande, 2016-01-12
2 answers
Creo que si quieres pasar una plantilla, debes usar
templateUrl: 'home/home.html'
Que debe hacer una solicitud http y cargar el html en su componente.
67
Author: Michele Ricciardi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-12 11:28:13
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-12 11:28:13
Es posible que desee considerar el uso de Webpack. En ese caso, simplemente:
@Component({
selector: 'my-comp',
template: require('./mycomp.component.html')
})
He encontrado que es una solución sólida hasta ahora, ya que en realidad lanzará un error de tiempo de compilación si la URL es incorrecta.
7
Author: Simon S.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-06 20:08:19
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-06 20:08:19