设置后使用angular4Hash为true得到异常

时间:2017-12-08 17:38:45

标签: jquery angular

我已将var useHash设置为true,并在加载页面后立即获得以下异常。

public getData() {
this.postsService.getAllPosts().subscribe(results => {
  this.myPosts= results['data'];    
});
}

filterByDate(){
  const monthAgo= moment().subtract(1, 'month');
   this.myPosts= this.myPosts.filter(item => moment(item.SubmittedDate).isAfter(monthAgo));
}

更改的代码是:

zone.js:195 Uncaught Error: Syntax error, unrecognized expression: #/
at Function.ga.error (jquery-3.2.1.min.js:2)
at ga.tokenize (jquery-3.2.1.min.js:2)
at ga.select (jquery-3.2.1.min.js:2)
at Function.ga [as find] (jquery-3.2.1.min.js:2)
at r.fn.init.find (jquery-3.2.1.min.js:2)
at new r.fn.init (jquery-3.2.1.min.js:2)
at r (jquery-3.2.1.min.js:2)
at HTMLAnchorElement.<anonymous> (scripts.bundle.js:7)
at jquery-3.2.1.min.js:2
at Function.map (jquery-3.2.1.min.js:2)

转移到jquery-3.2.1.js后:

ON Zone.js:

 export const routing = RouterModule.forRoot(appRoutes, { useHash: true });

on jquery-3.2.1.js

try {
            if (task.type == macroTask && task.data && 
!task.data.isPeriodic) {
                task.cancelFn = null;
            }
            try {
                return this._zoneDelegate.invokeTask(this, task, 
applyThis, applyArgs);
            }
            catch (error) {
                if (this._zoneDelegate.handleError(this, error)) {
                    throw error;
                }
            }
        }

我的app.routing.ts看起来像:

Sizzle.error = function( msg ) {
  throw new Error( "Syntax error, unrecognized expression: " + msg ); 
 };

有任何线索如何解决这个问题?

0 个答案:

没有答案