https://github.com/faizmh/meteor_angular2_router_issuesУстаревшие методы Метеор angular2 UI Router Issue
Я пытаюсь перейти с домашней страницы на рынке страницы.
В домашней странице, я пробовал разные варианты переход к рыночной странице
Моей страницы целевого рынка, считывает данные из БДА с помощью метода Метеора RPC с помощью наблюдаемого
В случае наследства счетов пакета и метеор методы, угловой интерфейс не может визуализировать данные
home.component.html
home page
<a [routerLink]="['/market']"> Market</a>
<button (click)="direct()">Direct Router</button>
<button (click)="accounts_package()">Using meteor accounts_package</button>
<button (click)="meteor_methods()">Using meteor Methods</button>
<button (click)="meteor_observable()">Using meteor meteor_observable</button>
home.component.ts
import { Component} from '@angular/core';
import template from './home.component.html';
import { Router, CanActivate } from '@angular/router';
import { Injectable } from '@angular/core';
import { MeteorObservable } from 'meteor-rxjs';
import { Meteor } from 'meteor/meteor';
@Component({
selector: 'home',
template
})
@Injectable()
export class HomeComponent {
constructor(private router:Router){
}
direct(): void {
console.log('calling direct')
this.router.navigate(['market']);
console.log(this.router)
}
meteor_observable(): void {
console.log('calling meteor_observable')
let router = this.router
MeteorObservable.call('logout').subscribe((markets) => {
router.navigate(['market']);
}, (error) => {
console.log(`Failed to receive market_filter due to ${error}`);
});
}
accounts_package(): void {
console.log('calling accounts_package')
let router = this.router
Meteor.logout(function(){
router.navigate(['market']);
});
}
meteor_methods(): void {
console.log('calling meteor_methods')
Meteor.call('logout', (error,result) => {
this.router.navigate(['market']);
})
}
}
market.component.ts
import { Component} from '@angular/core';
import template from './market.component.html';
import { MeteorObservable } from 'meteor-rxjs';
import { Meteor } from 'meteor/meteor';
@Component({
selector: 'market',
template,
})
export class MarketComponent {
private markets
constructor() {
MeteorObservable.call('market_filter').subscribe((markets) => {
this.markets = markets
}, (error) => {
console.log(`Failed to receive market_filter due to ${error}`);
});
}
}
market.component.html
Markets are {{markets}}
Нам нужно больше кода. Показать код, который работает, не помогает. Покажите нам свои маршруты и, возможно, даже шаблоны. – Mikkel