0

使用 angular2 beta 12,在Firefox中我收到以下错误:

EXCEPTION: Error: Uncaught (in promise): TypeError: pipe is undefined angular2.dev.js:23730:9

STACKTRACE: angular2.dev.js:23730:9

resolvePromise@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:543:32
makeResolver/<@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:520:14
Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:332:20
NgZoneImpl/this.inner<.onInvoke@http://localhost:2068/node_modules/angular2/bundles/angular2.dev.js:2216:22
Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:331:20
Zone</Zone</Zone.prototype.run@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:227:25
scheduleResolveOrReject/<@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:576:53
Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:365:24
NgZoneImpl/this.inner<.onInvokeTask@http://localhost:2068/node_modules/angular2/bundles/angular2.dev.js:2208:22
Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:364:24
Zone</Zone</Zone.prototype.runTask@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:263:29
drainMicroTaskQueue@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:482:26
ZoneTask/this.invoke@http://localhost:2068/node_modules/angular2/bundles/angular2-polyfills.js:434:22

它与我的代码无关,所以我认为这是一个角度错误。这是一个知道问题吗?有解决方法吗?

我从未声明过管道变量,我只是使用自定义管道:

import {Pipe, PipeTransform} from 'angular2/core';

@Pipe({
    name: 'myfilter',
    pure: false
})
export class MyFilterPipe implements PipeTransform 
{
    static _string:string = "string";

    transform (value:any[], [queryString]) 
    {     
        if (!queryString || queryString === '')
            return value;

        return value.filter (item => 
        {
            if (typeof item === MyFilterPipe._string)
            {
                return item.toLowerCase().indexOf (queryString.toLowerCase()) > -1;
            }

            for (var propertyName in item) {
                var propertyValue = item [propertyName];

                if (!propertyValue)
                    continue;

                if ((propertyValue + '').toLowerCase().indexOf (queryString.toLowerCase()) > -1)
                    return true;
            }
            return false;
        });
    }
}

它适用于 Chrome、Safari、Edge 非常感谢

4

0 回答 0