#1 It was my error in the post. In a code it is ok.

#2 I hold my components in folders. Application's folder is before Dialog's
folder. I have tried with forwardRef (i see it for the first time) and I'am
getting this error:

EXCEPTION: Unconditional component cycle in Application

this is application.ts:

import {Component, View} from "angular2/angular2";
import {EditView} from "component/editview/editview";
import {ApplicationModel} from "model/applicationmodel";
import {EditViewModel} from "model/editviewmodel";
import {NgFor, NgIf} from "angular2/angular2";

@Component({
selector: "application",
properties: ["model:model"]
})

@View({
templateUrl: "component/application/application.html",
directives: [EditView, NgFor, NgIf]
})

export class Application {
model: ApplicationModel;

isEditViewActive(editView: EditViewModel) {
return editView.active;
}

isForShow(index: number) {
if (index == 0) return true;
else false;
}


getClassForShow(editView: EditViewModel) {
if (editView.active) return "active";
else "";
}

private selectChild(model: EditViewModel){
if (model.children.length >0){
var active = model.children.filter(value =>value.active)
if (!active){
var child = model.children[0];
child.active = true;
this.selectChild(child);
}
}
}



}


editview.ts:

import {Component, View} from "angular2/angular2";

import {NgFor, NgIf} from "angular2/angular2";
import {Toolbar} from "component/toolbar/toolbar";



import {EditViewModel} from "model/editviewmodel";

import {TableEditView} from "component/editview/table-editview";

import {SingleEditView} from "component/editview/single-editview";

import {BafDialog} from "component/dialog/baf-dialog";



@Component({
selector: "editview",
properties: ["model:model"]
})

@View({
templateUrl: "component/editview/editview.html",
directives: [NgFor, NgIf, Toolbar, TableEditView,
SingleEditView,EditView,BafDialog]
})

export class EditView {


model: EditViewModel;


isEditViewActive(editView: EditViewModel) {
return editView.active;
}

isForShow(index: number) {
if (index == 0) return true;
else false;
}


getClassForShow(editView: EditViewModel) {
if (editView.active) return "active";
else "";
}

private selectChild(model: EditViewModel) {
if (model.children.length > 0) {
var active = model.children.filter(value => value.active)
if (!active) {
var child = model.children[0];
child.active = true;
this.selectChild(child);
}
}
}




hasChildren() {
return this.model.children.length > 0;
}

isTableView() {
return this.model.isTableView();
}

selectView(type: number) {
this.model.selectView(type);
}



getTableClass() {
if (this.model.isTableView()) {
return "active";
}
else {
return "";
}
}
getSingleClass() {
if (!this.model.isTableView()) {
return "active";
}
else {
return "";
}
}



}


baf-dialog.ts:

import {Component,View,forwardRef} from "angular2/angular2";

import {EditViewModel} from "../../model/editviewmodel";

import {Application} from "component/application/application";


import {EditView} from "component/editview/editview";

import {Field} from "component/field/field";


@Component({
selector: "baf-dialog",
properties:["model"]
})

@View({
templateUrl: "component/dialog/baf-dialog.html",
directives:[(forwardRef(() => Application))]
})

export class BafDialog {
model: EditViewModel;

}



Zlatko


Zlatko

On Sun, Sep 20, 2015 at 12:50 AM, Eric Martinez <[email protected]>
wrote:

> Zlatko,
>
> you've need to show more code.
>
> Here are my guessings
>
> - Your component is Application, not Appplication (note the 3 p's)
> - Your Application component is defined after your Dialog component, so
> you should have to use forwardRef
>   like this :
>
> directives : [(forwardRef() => Application)]
>
>
> Regards,
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/tDU5sw1vBwc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to