2017-06-15 23 views
1

定義されていませんが、私は各ページにこのエラーが表示されます。私はアプリでは何も変わっていない enter image description hereAngular2エラーself.parentView.contextが..私は私の角度2 Webアプリケーションに行くことにしようとしている

、私のチームの人々のコンピュータで動作します。

npm install

NPM非推奨[email protected]をWARN:AGM /コア@新しい パッケージ名
を使用してください - ここでは詳細:HTT:// ... NPM WARNは、グローバル リンパ節転移を好みます[email protected]はCをインストール[email protected] -g

でインストールする必要があります。... \ node_modules \ノード-SASS ノードスクリプト/のinstall.js

ダウンロード2進数: https://github.com/sass/node-sass/releases/download/v4.5
0.3/Win32の-x64-48_binding.nodeダウンロード完全なバイナリは Cに保存:... \ node_modules \ノード-SASSの\ベンダーの\ win32の-x64-48 \ビンディ ng.nodeキャッシュバイナリへ C :\ Users \ユーザートト\のAppData \ローミング\ NPM-キャッシュ\ノード-SASS WIN3 \ 4.5.3
2-x64-48_binding.node

[email protected]のインストール後のC:\ ... \ node_modules \ タイピングが

タイピングがENOENTパスをWARNインストールtslerp "のC:... \ node_modules \ tslerp \ typings.json" がありません

` - (ノー依存関係)

[email protected]インストール後のC:\ Users \ユーザーaviale \ドキュメント\ DEVワークスペース\ \ PlaceDesFa
MILLES \ PlaceDesFamilles \ PlaceDesFamillesFront \ node_modules \ノード-SASS ノードスクリプト/ build.js

バイナリ Cで発見:\ Users \ユーザーavialeドキュメント\ \ DEVワークスペース\ \ PlaceDesFamilles \ PlaceDe
sFamilles \ PlaceDesFamillesFrontテストバイナリバイナリng.node \ node_modules \ノード-SASS \ベンダ\ win32の-x64-48用の\ビンディ が細かい

[email protected]インストール後C:... \ node_modules \ NG2-グーグル -recaptcha タイピングが

タイピングが ENOENTパスをWARNインストール "C:... \ node_modules \ NG2-グーグル-reCAPTCHAののの\ typings.jsonは" `

が欠落しています - (依存なし)

[email protected] C:... + - @ angular/cli @ 1.0.0-beta.31 | + - @ ngtools/json-schema @ 1.0.3 | + - @ ngtools/webpack @ 1.2.9 | | + - [email protected]。0 | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | [email protected] | + - [email protected] | | -- [email protected] | | - リジェネータ - ランタイム@0.10.5 | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | | [email protected] | | + - [email protected] | | | -- [email protected] | | | [email protected] | | + - [email protected] | | | -- [email protected] | | | [email protected] | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | | [email protected] | | -- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | | - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | | -- [email protected] | | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | -- [email protected] | | | - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | -- [email protected] | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- postcs[email protected] | | | - [email protected] | | + - [email protected] | | 0135.14 | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | | +-- [email protected] | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | | - [email protected] | | | -- [email protected] | | | +-- [email protected] | | | | - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | + - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | - [email protected] | | -- [email protected] | +-- [email protected] | |- [email protected] | + - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | | + - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | | -- [email protected] | | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | | + - [email protected] | | | | | + - [email protected] | | | | | + - [email protected] | | | | | | -- [email protected] | | | | | | +-- [email protected] | | | | | | - [email protected] | | | | | -- [email protected] | | | | +-- [email protected] | | | | | - [email protected] | | | | + - [email protected]。0 | | | | | + - [email protected] | | | | | + - [email protected] | | | | | + - [email protected] | | | | | -- [email protected] | | | | | +-- [email protected] | | | | | - [email protected] | | | | -- [email protected] | | | - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - 復元- ... UNMET PEER DEPENDENCY @ angular/platform-b​​rowser @ 4.2.2 | + - @ types/fullcalendar @ 2.7.43 | -- UNMET PEER DEPENDENCY [email protected]^0.8.4 +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | - [email protected] | | + - [email protected] | | + - [email protected] | | -- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | -- [email protected] | +-- [email protected] | - [email protected] + - [email protected] + - [email protected] + - jasmin[email protected] + - jasmine-spec-reporter @ 2.5.0 | -- [email protected] +-- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | - [email protected] | | -- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | -- [email protected] | | - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected] | | -- [email protected] | | - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | | -- [email protected] | | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | | - [email protected] | | | | -- [email protected] | | | - [email protected] | | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | - [email protected] | | | + - [email protected] | | | | + - [email protected] | | | | + - [email protected] | | | | | -- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | |- [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | | - [email protected] | | | -- [email protected] | | - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | - [email protected] | + - [email protected] | -- [email protected] | +-- [email protected] |- [email protected] [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | - [email protected] | | -- [email protected] | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | - [email protected] | | -- [email protected] | - [email protected] | + - [email protected] | + - del2.2.2 | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | | -- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | -- [email protected] | +-- [email protected] | - [email protected] + - [email protected] | -- [email protected] +-- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected]。0 | | | -- [email protected] | | |- [email protected] | | + - [email protected] | | | -- [email protected] | | - [email protected] | -- [email protected] +-- [email protected] | +-- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | | -- [email protected] | +-- [email protected] | - [email protected] | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | - [email protected] | + - [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | -- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | + - [email protected] | + - [email protected] | | -- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | | - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | - [email protected] | + - [email protected] | | -- [email protected] | - [email protected] + - [email protected] + - [email protected] | + - [email protected] | + - [email protected] | | + - [email protected] | | ` - [email protected] | | + -

[email protected] | | -- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | + - [email protected] | | | | -- [email protected] | | | [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | -- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | | - [email protected] | | -- [email protected] | +-- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | - [email protected] | | + - [email protected] | | | -- [email protected] | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | - [email protected] | | | -- [email protected] | | +-- [email protected] | | - [email protected] | -- [email protected] - [email protected]

NPMが任意スキッピングOPTIONAL依存性をWARN:[email protected]^1.0.0 (node_modules \ CH
okidar \ node_modules \ fsevents):NPM OPTIONAL 依存性をスキップnotsup WARN:サポートされていませんプラットフォーム:@
1.1.2:want {"os": "darwin"、 "arch": "any"}(現在:{"os": "win32"、 "arch": "x64"}
)npm WARN @ angular/forms @ 4.2.2では、@ angle/platform-b​​rowser @ 4.2.2
のピアが必要ですが、何もインストールされていません。 npm WARN @ angular/core @ 4.2.2では[email protected]^0.8.4のピア が必要ですが、noneはinst
alledです。ここで

app.component.ts次のとおりです。ここで

import { Component, ViewContainerRef } from '@angular/core'; 
import { Router } from '@angular/router'; 
import { Modal, Overlay } from 'angular2-modal'; 
import { Utilisateur } from './shared/utilisateur'; 
import { PanierService } from './panier.service'; 
import { ParentService } from './parent.service'; 
import { ConfirmDialogModule, ConfirmationService } from 'primeng/primeng'; 
import { PanierNumber } from './shared/panier'; 


@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'], 
    providers: [PanierNumber] 

}) 
export class AppComponent { 
    userRole: string; 
    displayLogin: boolean = false; 
    displayRegister: boolean = false; 
    open: any = -1; 
    year: number; 
    nrPanier: number; 

    constructor(private utilisateur: Utilisateur, private router: Router, private modal: Modal, overlay: Overlay, viewContainer: ViewContainerRef, 
       private confirmationService: ConfirmationService, private panierService: PanierService, private parentService: ParentService, private panierNumber: PanierNumber) { 
       this.nrPanier = 0; 
       this.year = new Date().getFullYear(); 
       overlay.defaultViewContainer = viewContainer; 
       this.utilisateur.mySubject.subscribe(
        value => { 
         this.userRole = value; 
         this.displayLogin = false; 
        } 
       ); 
        if(localStorage.getItem("currentUserPDF")){ 
        this.utilisateur.role = JSON.parse(localStorage.getItem("currentUserPDF")).role; 
        if(JSON.parse(localStorage.getItem("currentUserPDF")).role == "PARENT"){ 
         this.parentService.getParent(JSON.parse(localStorage.getItem("currentUserPDF")).id).subscribe(r => { 
          r.enfants.forEach(e => { 
           this.panierService.getPanier(JSON.parse(localStorage.getItem("currentUserPDF")).id, e.id).subscribe(r => { 
            r.forEach(h => { 
             this.nrPanier++; 
            }); 
            this.panierNumber.setNumber(this.nrPanier); 
           }); 
          }); 

         }); 

         this.panierNumber.numberPanier$.subscribe(nr => { 
         this.nrPanier = nr; 
         }); 
        } 
        } 

    } 
    checkToken() { 
     if(localStorage.getItem("accessToken")) { 
     return true; 
     } 
     return false; 
    } 
    confirmLogout() { 
     this.confirmationService.confirm({ 
      message: 'Êtes-vous sûr de vouloir vous déconnecter ?', 
      header: "Déconnexion", 
      accept:() => { 
      localStorage.removeItem('currentUserPDF'); 
      localStorage.removeItem("accessToken"); 
      this.router.navigate(['']); 
      } 
     }); 
    } 
    openLoginModal() { 
     this.displayLogin = true; 
    } 
    openRegisterModal() { 
     this.displayRegister = true; 
    } 
    toggle() { 
    this.open = this.open*-1; 
    } 
    isOpen() { 
    if(this.open>0) { 
     return true; 
    } else { 
     return false; 
    } 
    } 
    goToPanier(){ 
    this.router.navigate(['/panier']); 
    } 
} 

は私package.json次のとおりです。ここで

{ 
    "name": "place-des-familles-front", 
    "version": "0.0.0", 
    "license": "MIT", 
    "angular-cli": {}, 
    "scripts": { 
    "ng": "ng", 
    "start": "ng serve", 
    "test": "ng test", 
    "lint": "ng lint", 
    "e2e": "ng e2e" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular/common": "^2.4.0", 
    "@angular/compiler": "^2.4.0", 
    "@angular/core": "^2.4.0", 
    "@angular/forms": "^2.4.0", 
    "@angular/http": "^2.4.0", 
    "@angular/platform-browser": "^2.4.0", 
    "@angular/platform-browser-dynamic": "^2.4.0", 
    "@angular/router": "^3.4.0", 
    "@types/fullcalendar": "^2.7.42", 
    "@types/jquery": "^2.0.44", 
    "angular2-google-maps": "^0.17.0", 
    "angular2-modal": "^2.0.3", 
    "ap-angular2-fullcalendar": "^1.2.8", 
    "core-js": "^2.4.1", 
    "fullcalendar": "^3.4.0", 
    "jquery": "^3.2.1", 
    "moment": "^2.18.1", 
    "ng2-google-recaptcha": "1.1.0", 
    "primeng": "^2.0.6", 
    "rxjs": "^5.0.1", 
    "ts-helpers": "^1.1.1", 
    "typings": "2.1.0", 
    "zone.js": "^0.7.2" 
    }, 
    "devDependencies": { 
    "@angular/cli": "1.0.0-beta.31", 
    "@angular/compiler-cli": "^2.4.0", 
    "@types/jasmine": "2.5.38", 
    "@types/jquery": "^2.0.43", 
    "@types/node": "^6.0.42", 
    "codelyzer": "~2.0.0-beta.1", 
    "jasmine-core": "2.5.2", 
    "jasmine-spec-reporter": "2.5.0", 
    "karma": "1.2.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-coverage-istanbul-reporter": "^0.2.0", 
    "karma-jasmine": "^1.0.2", 
    "protractor": "~5.1.0", 
    "ts-node": "1.2.1", 
    "tslint": "^4.3.0", 
    "typescript": "~2.0.0" 
    } 
} 

は私app.component.html次のとおりです。

<nav> 
    <a routerLink=''><img src="./assets/img/logo.png" height="66"></a> 
    <button class="collapse" type="button" pButton (click)="toggle()" icon="fa-bars"></button> 
    <div class="nav1"> 
     <div *ngIf="!checkToken()"> 
      <div class="navbar-div" ><a class="navbar-a" routerLink='./rechercher_creche'> recherche </a></div> 
      <div class="navbar-div" ><a class="navbar-a" routerLink='./register'> inscription </a></div> 
      <div class="navbar-div"><a class="navbar-a" (click)="openLoginModal()"> connexion </a></div> 
     </div> 
     <div *ngIf="checkToken()"> 
      <div class="navbar-div" *ngIf="checkToken() && utilisateur.role.toLowerCase()=='parent'" (click)="goToPanier()" style="cursor: pointer;"> 
       <img src="./assets/img/panier.jpg" style="width: 20px; float: right"/> 
       <span style="float: right; color: #428bca;">{{nrPanier}}</span> 
      </div> 
      <div class="navbar-div" ><a class="navbar-a" (click)="confirmLogout()"> déconnexion </a></div> 
      <div class="navbar-div" *ngIf="utilisateur.role.toLowerCase()=='parent'"><a class="navbar-a" routerLink='compte_famille'> mon compte </a></div> 
      <div class="navbar-div" *ngIf="utilisateur.role.toLowerCase()!='parent'"><a class="navbar-a" routerLink='etablissement'> professionnels </a></div> 
     </div> 

    </div> 
    <div class="nav2" [ngClass]="{'in': isOpen()}"> 
     <div *ngIf="!checkToken()"> 
      <div class="navbar-div" (click)="toggle()"><a class="navbar-a" (click)="openLoginModal()"> connexion </a></div> 
      <div class="navbar-div" (click)="toggle()"><a class="navbar-a" routerLink='./register'> inscription </a></div> 
      <div class="navbar-div" (click)="toggle()"><a class="navbar-a" routerLink='./rechercher_creche'> recherche </a></div> 
     </div> 
     <div *ngIf="checkToken()"> 
      <div class="navbar-div" (click)="toggle()"><a class="navbar-a" routerLink='compte_famille'> mon compte </a></div> 
      <div class="navbar-div" (click)="toggle()"><a class="navbar-a" (click)="confirmLogout()"> déconnexion </a></div> 
      <div class="navbar-div" *ngIf="checkToken() && utilisateur.role.toLowerCase()=='parent'" (click)="goToPanier()" style="cursor: pointer;"> 
       <img src="./assets/img/panier.jpg" style="width: 20px; float: right"/> 
       <span style="float: right; color: #428bca;">{{nrPanier}}</span> 
      </div> 
     </div> 
    </div> 
</nav> 

<div class="container"> 
    <router-outlet></router-outlet> 
</div> 


<p-dialog header="Connexion" [(visible)]="displayLogin" [dismissableMask]="true" modal="modal" responsive="true" styleClass="crecheTab"> 
    <login></login> 
</p-dialog> 

<p-confirmDialog icon="fa fa-question-circle" #cd responsive="true"> 
    <p-footer> 
     <button type="button" pButton icon="fa-close"label="Non" (click)="cd.reject()" style="background-color:#3887C9;font-family: raleway;"></button> 
     <button type="button" pButton icon="fa-check" label="Oui" (click)="cd.accept()" style="background-color:#3887C9;font-family: raleway;"></button> 
    </p-footer> 
</p-confirmDialog> 

<footer> 
    <div class="foot1 ui-g"> 
     <table class='footer-table ui-g-10 ui-md-4 ui-lg-3'> 
      <tr> 
       <th class='footer-th'> C'EST PRATIQUE </th> 
      </tr> 
      <tr> 
       <td> 
        <ul class='footer-ul'> 
         <li> <a class='footer-a' routerLink=''> Foire aux questions </a></li> 
         <li> <a class='footer-a' routerLink=''> Professionnels petite enfance </a></li> 
         <li> <a class='footer-a' routerLink=''> Application mobile </a></li> 
        </ul> 
       </td> 
      </tr> 
     </table> 
     <table class='footer-table ui-g-10 ui-md-4 ui-lg-3'> 
      <tr> 
       <th class='footer-th'> C'EST NOUS ! </th> 
      </tr> 
      <tr> 
       <td> 
        <ul class='footer-ul'> 
         <li> <a class='footer-a' routerLink='./qui_sommes_nous'> Qui nous sommes ? </a></li> 
         <li> <a class='footer-a' routerLink=''> Nos partenaires </a></li> 
         <li> <a class='footer-a' routerLink=''> Nous recrutons </a></li> 
        </ul> 
       </td> 
      </tr> 
     </table> 
     <table class='footer-table ui-g-10 ui-md-4 ui-lg-3'> 
      <tr> 
       <th class='footer-th'> C'EST LÉGAL </th> 
      </tr> 
      <tr> 
       <td> 
        <ul class='footer-ul'> 
         <li> <a class='footer-a' routerLink='./cgu'> Conditions générales d'utilisation </a></li> 
         <li> <a class='footer-a' routerLink='./mentions_legales'> Notice légale </a></li> 
        </ul> 
       </td> 
      </tr> 
     </table> 
    </div> 

    <div class="foot2"> 
     Place des Familles - {{year}} <i class="fa fa-registered" aria-hidden="true"></i> 
    </div> 
</footer> 

EDIT:私は クラス 'utilisateur'では、ロールのデフォルト値を定義して定義しないでください。

@Injectable() 
export class Utilisateur { 
    public id: number; 
    public prenom: string; 
    public nom: string; 
    public login: string; 
    public role: string = 'guest'; 
    public codePostal: string; 
    public ville: string; 
    public accessToken: string; 
    public civilite: string; 
    public mySubject: BehaviorSubject<string> = new BehaviorSubject<string>(this.role); 
    public changeRole(): void { 
     this.mySubject.next(this.role); 
    } 
} 

私にはさらに詳しい情報があります。

+0

あなたのhtmlを含めることはできますか? – echonax

答えて

2

*ngIfを実行した時点でutilisateur.roleが定義されていないため、utilisateur.role.lowerCase()にエラーが発生しています。

*ngIf="utilisateur.role && utilisateur.role.toLowerCase()=='parent'"> 

はこれが最初のutilisateur.roleをチェックすると、それはundefinedであれば、それはfalseに評価されます:あなたはこのような回避策を行うことができます。

+0

'* ngIf'を実行する前にどのように定義できますか? – anais1477

+0

しかし私のクラスUtilisateurでは、ロールのデフォルト値を定義します。 '@Injectable() エクスポートクラスUtilisateur { public id:number; public prenom:string; public nom:string; public login:string; public role:string = 'ゲスト'; public codePostal:string; public ville:string; public accessToken:string; 公文書:文字列; public mySubject:BehaviorSubject = new BehaviorSubject (this.role); public changeRole():void { this.mySubject.next(this.role); } } ' – anais1477

+0

@ anais1477ここから読みにくいです。あなたの質問にそれを追加できますか?そして、それをあなたのsubscribe関数の前にコンストラクタ内で定義することができます。そして、この答えはうまくいきませんでしたか?あなたは実質的にヌル値をチェックしていますが、IMOは常により安全です。 – echonax

関連する問題