typescript angular.1.x.component.example.ts
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript angular.1.x.component.example.ts相关的知识,希望对你有一定的参考价值。
import { CandidateColumns } from './../candidate.common';
import { ICandidatesFilter, CandidateTopService } from './../candidate.top/candidate.top.service';
import { IModalConfig } from './../../../components/custom.modal/custom.modal.component';
import { IDataGridConfig, IAction, ActionButtonType } from './../../../components/data.grid/data.grid.component';
import { CrewListService } from './crew.list.service';
import * as _ from 'lodash';
export class CrewListPage {
static readonly selector: string = 'crewList';
static readonly template: string = require('../abstract.candidate.list.jade')();
static readonly controller = CrewListPage;
static readonly $inject = ['crew.list.service', 'candidate.top.service', 'toastr'];
dataGridConfig: IDataGridConfig;
modalConfig: IModalConfig;
constructor(private _crewListService: CrewListService, private _candidateTopService: CandidateTopService, private _toastr) { }
$onInit(): void {
this.modalConfig = <IModalConfig>{};
this.dataGridConfig = <IDataGridConfig>{
view: {
columns: CandidateColumns,
actions: <IAction[]>[
{
class: 'btn-blue',
paramKey: '_id',
title: 'Flash CV',
type: ActionButtonType.Button,
callback: id => {
},
},
{
class: 'btn-purple',
paramKey: '_id',
type: ActionButtonType.Button,
title: 'Adv CV',
callback: id => {
alert(id);
}
},
{
class: 'btn-chat',
paramKey: '_id',
type: ActionButtonType.Button,
title: 'Chat',
showCriteria: data => true
},
{
class: 'btn-favorite',
paramKey: '_id',
type: ActionButtonType.Button,
title: 'Favorite',
callback: data => {
this._candidateTopService.addToFavorite(data)
.success(data => {
if (!data.isError)
this._toastr.success(data.text);
});
},
disabled: data => true
},
{
class: 'btn-orange',
paramKey: '_id',
type: ActionButtonType.Button,
title: 'Notes',
callback: data => {
this.modalConfig.display = !this.modalConfig.display;
}
}
]
},
design: {
loading: true,
rows: true,
firstOpened: true
},
data: {
params: <ICandidatesFilter>{},
loader: () => {
this.dataGridConfig.data.params.page = this.dataGridConfig.paginator.current;
return this._crewListService.getMyCrewList(this.dataGridConfig.data.params)
.success(data => {
this.dataGridConfig.data.model = data.favorites;
_.map(this.dataGridConfig.data.model, e => {
e['last_login'] = this._candidateTopService.formatAcitivty(e['last_login']);
});
this.dataGridConfig.paginator.amount = data.pages;
});
}
}
}
}
}
以上是关于typescript angular.1.x.component.example.ts的主要内容,如果未能解决你的问题,请参考以下文章