When my component initializes, I retrieve data from the server
import {Rules} from "../../interfaces/interfaces";
rules: Rules
ngOnInit() {
this.tt = this.rulesService.getUserClientRules().subscribe(
t => {
console.log(t)
console.log(t.clientRules.canAll)
this.rules = t.clientRules
},
error => {
console.log(error.error.message)
}
)
}
The code for my service is as follows:
getUserClientRules(): Observable<Rules> {
return this.http.get<Rules>('/api/rules/getClientUserRules/')}
I also have an interface defined:
export interface Rules {
clientRules: any
}
The response I receive looks like this:
{clientRules: {canAll: true, canSee: false}}
How do I incorporate this object into my rules object? I would like to access it as rules.canAll or rules.canSeeAll...
I require the structure of rules { canAll: true, canSee: true } for conditional checks like *ngIf="rules.canSee"
Appreciate all your help and insights!