angularjs 九

前端之家收集整理的这篇文章主要介绍了angularjs 九前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
import {Component} from 'angular2/core';
import {ExponentialStrengthPipe} from './exponential-strength';

@Component({
    selector: 'appTest',template: `
    <h2>Power Booster</h2>
    <p>
      Super power boost: {{10 | exponentialStrength : 10}}
    </p>
  `,pipes: [ExponentialStrengthPipe]
})

export class App {

}  



/**
 * Created by dell on 2016/9/8.
 */
import {Pipe,PipeTransform} from 'angular2/core';
/*
 * Raise the value exponentially
 * Takes an exponent argument that defaults to 1.
 * Usage:
 *   value | exponentialStrength:exponent
 * Example:
 *   {{ 2 |  exponentialStrength:10}}
 *   formats to: 1024
 */
@Pipe({name: 'exponentialStrength'})
export class ExponentialStrengthPipe implements PipeTransform {
    transform(value:number,args:string[]) : any {
        return value + parseInt(args[0]);
    }
}
原文链接:https://www.f2er.com/angularjs/148890.html

猜你在找的Angularjs相关文章