-
Notifications
You must be signed in to change notification settings - Fork 1
Subscription Model
Thor Schueler edited this page Mar 10, 2017
·
2 revisions
The Subscription model implements the model for the SubscriptionBadge Component. An instance of the model is generated and delivered by the Subscriptions Service.
The Subscription model is a POCO with the following properties:
- Label - Gets the subscription label
- Count - Gets the number of new events in the subscription
- FAIcon - Gets the font awesome css tag for an icon associated with the subscription
- Detail - Gets the url of the details page for the subscription
- BadgeClass - Gets a css class string to be associated with the subscription
You can construct a new Subscription model instance using its constructor:
constructor(
label: string,
count: number,
faIcon: string,
badgeClass?: string,
detail?: string)
Parameters:
- label - String containing the subscription label
- count - Number containing the event count in the subscription
- faIcon - String containing the font awesome css tag for the subscription icon. Use an empty string if there is no icon.
- badgeClass - Optional. String containing the css class for the subscription.
- detail - Optional. String containing a url to a detailed representation of the subscription
The following example implements a simple ng2 component using the Subscription model to display a information about a subscription:
import { Component } from '@angular/core';
import { Subscription } from 'ng2-app-scaffold';
@Component({
selector: 'subscription',
template: `
<div class="subscription">
<a *ngIf="s.Detail == null || s.Detail == ''">
<li class="list-group-item">
<span class="badge {{s.BadgeClass}}">{{s.Count}}</span> <i class="fa {{s.FAIcon}} icon"></i> {{s.Label}}
</li>
</a>
<a *ngIf="s.Detail != null && s.Detail != ''" [routerLink]=[s.Detail]>
<li class="list-group-item">
<span class="badge {{s.BadgeClass}}">{{s.Count}}</span> <i class="fa {{s.FAIcon}} icon"></i> {{s.Label}}
</li>
</a>
</div>
`
})
export class User{
s:Subscription;
constructor(){
this.s= new Subscription(
'New Tasks', 5, "fa-check", "taskNotification", "/home");
}
}