0
votes

Hi Guys I'm following Max's Udemy tutorial for the MEAN stack, I have issues with Material and now with elements not showing off.

Material and *ngFor used to be working just before I put my computer to sleep. my setup: Ubuntu, VSCode, node: 10.15.3, npm: 6.7.0

Here is my repo

also angular-cli is showing me this warning:

Your global Angular CLI version (7.3.6) is greater than your local version (7.0.7). The local Angular CLI version is used.

enter image description here

<mat-accordion>
  <mat-expansion-panel *ngFor="let post of posts">
    <mat-expansion-panel-header>
      {{post.title}}
    </mat-expansion-panel-header>
    <p>{{post.content}}</p>
  </mat-expansion-panel>
</mat-accordion>

package.json

{
  "name": "mean-course",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.0.0",
    "@angular/cdk": "~7.3.5",
    "@angular/common": "~7.0.0",
    "@angular/compiler": "~7.0.0",
    "@angular/core": "~7.0.0",
    "@angular/forms": "~7.0.0",
    "@angular/http": "~7.0.0",
    "@angular/material": "^7.3.5",
    "@angular/platform-browser": "~7.0.0",
    "@angular/platform-browser-dynamic": "~7.0.0",
    "@angular/router": "~7.0.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.10.0",
    "@angular/cli": "~7.0.3",
    "@angular/compiler-cli": "~7.0.0",
    "@angular/language-service": "~7.0.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.1"
  }
}
1
Please post your packages.json file. That's likely where you're having trouble. Regarding @angular/cli warning, you've likely defined it there and installed it globally; either remove it from packages.json or uninstall the global instance. I don't suspect that's your actual problem though.Dave Skender

1 Answers

1
votes

Change the line n°9 of post-list.component.html from

<p class="info-text mat-body-1" ngIf="posts.length <= 0"> No posts yet!</p>

to

<p class="info-text mat-body-1" *ngIf="posts.length <= 0"> No posts yet!</p>

You missed the * of *ngIf.


For the warning, it just says that you have a greater @angular/cli installed globally (npm install -g) than the one of your package.json but it can't be source of problems.