이는 각도 요소가 초기화되었지만 서버에서 유성 데이터에 도달하지 않은 경우 발생합니다. 는 HTML 부품 사용이
을에 인쇄 할 경우 Meteor.User
의 모든 값을해야합니다 이제 사용자 변수에 Meteor.user()
import {Component} from "@angular/core";
import { InjectUser } from 'angular2-meteor-accounts-ui';//<--**** import this****
@Component({
selector: "login-buttons",
template
})
@InjectUser('user') //<--*** add this***
export class LoginButtonsComponent {
user: Meteor.User; //<--*** add this ***
constructor(private router: Router) {}
}
대신에 사용자 주입을 사용하려고
<div *ngIf="user">
{{user.phone.number}}
</div>
는
는
meteor add accounts-password
meteor npm install --save angular2-meteor-accounts-ui
및 app.mod에 설치하는 것을 잊지 마세요 ule.ts 파일
import { AccountsModule } from 'angular2-meteor-accounts-ui';
@NgModule({
imports: [
... other modules here
AccountsModule
],
희망. 이게 작동하지 않으면 알려주지 다른 해결책을 말해 줄께
은'Meteor.user()'객체 아래의 모든 키를 인쇄하거나 보는 방법이 있습니까? – theonlygusti
{ \t "_id": "xk67327YLKYeiPnKE", \t "createdAt": ISODate ("2017-01-19T12 : 21 : 55.692Z "), \t"서비스 ": { \t \t"전화 ": {}, \t \t"이력서 ": { \t \t \t"loginTokens "[ \t \t \t \t { \t \t \t \t \t "when": ISODate ("2017-01-19T12 : 22 : 05.008Z"), \t \t \t \t \t "hashedToken": "CLBi1T8fthuGOqpiS2alZw7kaGm oiAYiCC4nJZoTssc = " \t \t \t \t}] \t \t} \t}, \t "전화 ": { \t \t"수 ":"9721234567 ", \t \t"확인 "TRUE}, \t" 프로필 ": { \t \t"이름 ":"Lф11 ", \t \t"regNum ":"Х205НА77 "}} – Dmitry
이것은 DB에서 추출한 것입니다. 사실 Meteor.user() 객체 키를 얻는 방법을 모르겠습니다. 또 다른 이상한 일은 Ctrl-Space Idea에 의해 DB에없는 username 속성을 보여줍니다. – Dmitry