Boa tarde a todos
Efetuei a implementação da primeira parte onde caso o usuário não esteja logado a mensagem Please, login! deve ser exibida ao usuário... Vejam:
header.component.html
<header class="fixed-top">
<nav class="navbar navbar-light bg-white">
<a class="navbar-brand">ALURAPIC</a>
<div *ngIf="user; else login">
<i class="fa fa-user-circle"></i>
<a class="ml-2"> {{ user.name }}}</a>
</div>
<ng-template #login>
<span class="navbar-text">
Favor efetue login!
</span>
</ng-template>
</nav>
</header>
Ao colocar no header.component.html ngIf="user; else login" em desenvolvimento a tela da aplicação já fica branca e um erro é exibido no console...
vendor.js:8730 Uncaught Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("v class="navbar navbar-light bg-white">
<a class="navbar-brand">ALURAPIC</a>
<div [ERROR ->]*ngIf="user; else login">
<i class="fa fa-user-circle"></i>
<a class="ml-2""): ng:///CoreModule/HeaderComponent.html@3:13
Can't bind to 'ngIfElse' since it isn't a known property of 'div'. ("v class="navbar navbar-light bg-white">
<a class="navbar-brand">ALURAPIC</a>
<div [ERROR ->]*ngIf="user; else login">
<i class="fa fa-user-circle"></i>
<a class="ml-2""): ng:///CoreModule/HeaderComponent.html@3:13
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". (" <nav class="navbar navbar-light bg-white">
<a class="navbar-brand">ALURAPIC</a>
[ERROR ->]<div *ngIf="user; else login">
<i class="fa fa-user-circle"></i>
<a class=""): ng:///CoreModule/HeaderComponent.html@3:8
Property binding ngIfElse not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". (" <nav class="navbar navbar-light bg-white">
<a class="navbar-brand">ALURAPIC</a>
[ERROR ->]<div *ngIf="user; else login">
<i class="fa fa-user-circle"></i>
<a class=""): ng:///CoreModule/HeaderComponent.html@3:8
at syntaxError (vendor.js:8730)
at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (vendor.js:23217)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (vendor.js:31224)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (vendor.js:31211)
at vendor.js:31154
at Set.forEach (<anonymous>)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (vendor.js:31154)
at vendor.js:31064
at Object.then (vendor.js:8721)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (vendor.js:31063)
Sei que é complicado determinar o erro assim, mas se puderem me ajudar agradeço!
Abraço
EDUARDO AGOSTINHO