-
-
Save ajcrites/7a985e8a487c050c6126b462b532cb68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { BusinessTypeService } from './businessTypes.service'; | |
@Component({ | |
selector: 'businesstype-list', | |
template: ` | |
<section> | |
<section *ngIf="isLoading && !errorMessage"> | |
Retrieving data from data.cityofgainesville.org... | |
</section> | |
<div class="business-categories"> | |
<!-- this is the new syntax for ng-repeat --> | |
<div class="business-category" *ngFor="let businessCategory of finalBusinessCategories"> | |
{{businessCategory.name}} | |
<div class="business-type" *ngFor="let businessType of businessCategory.businessTypes"> | |
{{businessType.business_type}} | |
<div class="permit" *ngFor="let permit of businessType.permits"> | |
{{permit.friendly_name}} | |
</div> | |
</div> | |
</div> | |
</div> | |
<section *ngIf="errorMessage"> | |
{{errorMessage}} | |
</section> | |
</section> | |
` | |
}) | |
export class BusinessTypeListComponent implements OnInit { | |
finalBusinessCategories: any = []; | |
errorMessage: string = ''; | |
isLoading: boolean = true; | |
constructor(private businessTypesService: BusinessTypeService) {} | |
ngOnInit() { | |
this.businessTypesService | |
.getAll() | |
.subscribe( | |
/* happy path */ b => this.finalBusinessCategories = b, | |
/* error path */ e => this.errorMessage = e, | |
/* onComplete */ () => this.isLoading = false); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"removeComments": false, | |
"noImplicitAny": true, | |
"suppressImplicitAnyIndexErrors": true | |
}, | |
"filesGlob" : [ | |
"**/*.ts", | |
"**/*.tsx", | |
"!node_modules/**" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment