TypeScript @angular-core.Injectable类(方法)实例源码

下面列出了TypeScript @angular-core.Injectable 类(方法)源码代码实例,从而了解它的用法。

作者:deepakrajendr    项目:WeatherAp   
@Injectable()
  /*
    Takes a value and makes it lowercase.
   */
  transform(value: string, args: any[]) {
   var c=Math.round(parseInt(value,10)-273.15);
   var f=Math.round(parseInt(value,10)*9/5-459.67);
 
   return `${c}°C `
  }

作者:troyanski    项目:ng2-resource-res   
export function ResourceODATAParams(params: ResourceODATAParamsBase) {
  const injectable = Injectable();
  const zuper = ResourceParams(params);

  return function (target: Type<Resource>) {
    injectable(target);
    zuper(target);
    target.prototype.getEntityName = function () {
      if (params.name) {
        return params.name;
      }
      return typeof params.entity === "string" ? params.entity : params.entity.name;
    };
  };
}

作者:fabioformos    项目:quartz-manage   
import { Injectable, OnInit } from '@angular/core';
import { WebsocketService } from '.';
import { SocketOption } from '../model/SocketOption.model';

Injectable()
export class ProgressWebsocketService extends WebsocketService {

    constructor(){
        super(new SocketOption('/quartz-manager/progress', '/topic/progress'))
    }

}

作者:aluanhadda    项目:ng2-conventions-decorator   
export const injectable: InjectionDecorator = <TFunction extends new (x: any, ...args: any[]) => any>(target: TFunction) => Injectable()(target);

作者:kichkinprojec    项目:wsm-clien   
import { Injectable } from '@angular/core';

Injectable({
  providedIn: 'root'
})
export class WsmDataService {

}


问题


面经


文章

微信
公众号

扫码关注公众号