Angular: DynamicComponentLoader loadIntoLocation لا يعمل بشكل صحيح في 2.0.0.beta.1

تم إنشاؤها على ١١ يناير ٢٠١٦  ·  3تعليقات  ·  مصدر: angular/angular

 Error during instantiation of AppComponent!.
There is no component directive at element [object Object]

يعمل على الإصدار beta.0:
http://plnkr.co/edit/p6w6bBZfkvXIdDabc1vI؟p=preview
تم كسره في النسخة التجريبية 1:
http://plnkr.co/edit/3Gn9ZuyMHUdlRqEmqVF7؟p=preview

التعليق الأكثر فائدة

حسب التغييرات الانكسارية

Component view is not yet created when component constructor is called. -> use onInit lifecycle callback to access the view of a component

لذا فإن نقل الكود الخاص بك إلى ngOnInit يعمل بشكل صحيح

    ngOnInit() {
      this.dcl.loadIntoLocation(ChildComponent, this.elementRef, 'child');
    }

ال 3 كومينتر

حسب التغييرات الانكسارية

Component view is not yet created when component constructor is called. -> use onInit lifecycle callback to access the view of a component

لذا فإن نقل الكود الخاص بك إلى ngOnInit يعمل بشكل صحيح

    ngOnInit() {
      this.dcl.loadIntoLocation(ChildComponent, this.elementRef, 'child');
    }

تضمين التغريدة

تم قفل هذه المشكلة تلقائيًا بسبب عدم النشاط.
يرجى تقديم مشكلة جديدة إذا كنت تواجه مشكلة مشابهة أو ذات صلة.

اقرأ المزيد حول سياسة قفل المحادثة التلقائي .

_تم تنفيذ هذا الإجراء تلقائيًا بواسطة روبوت.

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات