File

src/app/home-page/categories/categories.component.ts

Description


Container for all available tool categories. Each Category is generated based on the available tools.


Metadata

selector app-categories
styleUrls categories.component.css
templateUrl ./categories.component.html

Index

Properties
Methods

Constructor

constructor(toolService: ToolService, courseService: CourseService)

Constructor

Parameters :
Name Type Optional Description
toolService ToolService no

Used to generate each available category

courseService CourseService no

Verifies if course selection is open, so styling can be applied. Used in categories.component.html (i.e. DO NOT DELETE)


Methods

setSelectedCategory
setSelectedCategory(category: Category)

This sets the selected Category on the Tool service.

Parameters :
Name Type Optional Description
category Category no

The category to be set as the selected category

Returns : boolean

Returns false to prevent the entire page (just the router) from reloading


Properties

Public courseService
courseService: CourseService
Type : CourseService
Verifies if course selection is open, so styling can be applied. Used in categories.component.html (i.e. DO NOT DELETE) **********************************************************
Public toolService
toolService: ToolService
Type : ToolService
Used to generate each available category
import { Component } from '@angular/core';
import { ToolService } from '../../tool.service';
import { CourseService } from '../../course.service'; // Being used in categories.component.html (i.e. DO NOT DELETE)
import { Category } from '../../interfaces';

/** **********************************************************
 * Container for all available tool categories. Each {@link Category} is generated
 * based on the available tools.
 ************************************************************/
@Component({
    selector: 'app-categories',
    templateUrl: './categories.component.html',
    styleUrls: ['./categories.component.css']
})
export class CategoriesComponent {

    /** **********************************************************
     * Constructor
     * @param toolService Used to generate each available category
     * @param courseService Verifies if course selection is open, 
     * so styling can be applied. Used in 
     * categories.component.html (i.e. DO NOT DELETE)
     ************************************************************/
    constructor(public toolService: ToolService,
        public courseService: CourseService) { }

    /** **********************************************************
     * This sets the selected {@link Category} on the Tool service.
     * @param {object} category The category to be set as the selected category
     * @returns {false} Returns false to prevent the entire page (just the router) from reloading
     ************************************************************/
    setSelectedCategory(category: Category) {
        this.toolService.selectedCategory = category;
        return false;
    }
}
<div class="categories" [class.frosted]="this.courseService.courseSelectionOpen">
    <div *ngFor="let category of toolService.categories" (click)="setSelectedCategory(category)">
        <h1 class="white-text">{{category.title}}</h1>
        <div class="tools">
            <div *ngFor="let tool of this.toolService.toolList">
                <div (click)="this.toolService.selectedTool = tool" [routerLink]="['tools', tool.id, 'options']" class="toolIcon card" style="display: block"
                    [style.display]="tool.toolCategory === category.toolCategory ? 'block' : 'none'">
                    <i class="material-icons charcoal-text">{{tool.icon}}</i>
                    <p>{{tool.title}}</p>
                </div>
            </div>
        </div>
    </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""