multiple resolve guards , access to each from any route path



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I need to get access from 1 resolve guardian to another (from parent to child), where "another"(child) has async data, so how i can take this async data from child route to parent route



Here is some code



path



const routes: Route = [
path: '', redirectTo: 'main', pathMatch: 'full' ,
path: 'main', component: MainComponent ,
path: 'project',
component: ProjectContainerComponent,
children: [

path: ':id',
component: ProjectComponent,
data:
projectTitle: 'Все задачи',
groupBy: 'Без группировки'
,
resolve:
projectName: ProjectNameResolverService
,
children: [
path: '', redirectTo: 'list', pathMatch: 'full',
path: 'list', component: ProjectIssueListContainerComponent, children: [
path: '', component: ProjectIssueListComponent ,
path: ':issueId', component: ProjectIssueContainerComponent,
resolve:
task: IssueResolverService


] ,
path: 'create', component: CreateIssueComponent ,

]

]
,
path: 'access_denied', component: AccessDeniedComponent
]


child



export class IssueResolverService implements Resolve < any > 

constructor(
private projectsService: ProjectsService,
private router: Router
)

resolve(route: ActivatedRouteSnapshot)
const id = +route.paramMap.get('issueId');
return this.projectsService.getProjectTask(id)
.pipe(
map((task: any) =>
console.log(task);
return task
)
);





parent



export class ProjectNameResolverService 

constructor()
resolve(route: ActivatedRouteSnapshot)
console.log(route.firstChild.firstChild.data) // - but need to get it











share|improve this question
























  • Pass data may be using service

    – Pardeep Jain
    Nov 16 '18 at 17:45











  • at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

    – Den Kerny
    Nov 19 '18 at 8:02











  • get it between resolvers, thx

    – Den Kerny
    Nov 19 '18 at 8:25











  • but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

    – Den Kerny
    Nov 19 '18 at 8:30











  • and i cant pass data to component because of subscribe, i dont return smth except Subscriber

    – Den Kerny
    Nov 19 '18 at 8:47

















0















I need to get access from 1 resolve guardian to another (from parent to child), where "another"(child) has async data, so how i can take this async data from child route to parent route



Here is some code



path



const routes: Route = [
path: '', redirectTo: 'main', pathMatch: 'full' ,
path: 'main', component: MainComponent ,
path: 'project',
component: ProjectContainerComponent,
children: [

path: ':id',
component: ProjectComponent,
data:
projectTitle: 'Все задачи',
groupBy: 'Без группировки'
,
resolve:
projectName: ProjectNameResolverService
,
children: [
path: '', redirectTo: 'list', pathMatch: 'full',
path: 'list', component: ProjectIssueListContainerComponent, children: [
path: '', component: ProjectIssueListComponent ,
path: ':issueId', component: ProjectIssueContainerComponent,
resolve:
task: IssueResolverService


] ,
path: 'create', component: CreateIssueComponent ,

]

]
,
path: 'access_denied', component: AccessDeniedComponent
]


child



export class IssueResolverService implements Resolve < any > 

constructor(
private projectsService: ProjectsService,
private router: Router
)

resolve(route: ActivatedRouteSnapshot)
const id = +route.paramMap.get('issueId');
return this.projectsService.getProjectTask(id)
.pipe(
map((task: any) =>
console.log(task);
return task
)
);





parent



export class ProjectNameResolverService 

constructor()
resolve(route: ActivatedRouteSnapshot)
console.log(route.firstChild.firstChild.data) // - but need to get it











share|improve this question
























  • Pass data may be using service

    – Pardeep Jain
    Nov 16 '18 at 17:45











  • at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

    – Den Kerny
    Nov 19 '18 at 8:02











  • get it between resolvers, thx

    – Den Kerny
    Nov 19 '18 at 8:25











  • but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

    – Den Kerny
    Nov 19 '18 at 8:30











  • and i cant pass data to component because of subscribe, i dont return smth except Subscriber

    – Den Kerny
    Nov 19 '18 at 8:47













0












0








0








I need to get access from 1 resolve guardian to another (from parent to child), where "another"(child) has async data, so how i can take this async data from child route to parent route



Here is some code



path



const routes: Route = [
path: '', redirectTo: 'main', pathMatch: 'full' ,
path: 'main', component: MainComponent ,
path: 'project',
component: ProjectContainerComponent,
children: [

path: ':id',
component: ProjectComponent,
data:
projectTitle: 'Все задачи',
groupBy: 'Без группировки'
,
resolve:
projectName: ProjectNameResolverService
,
children: [
path: '', redirectTo: 'list', pathMatch: 'full',
path: 'list', component: ProjectIssueListContainerComponent, children: [
path: '', component: ProjectIssueListComponent ,
path: ':issueId', component: ProjectIssueContainerComponent,
resolve:
task: IssueResolverService


] ,
path: 'create', component: CreateIssueComponent ,

]

]
,
path: 'access_denied', component: AccessDeniedComponent
]


child



export class IssueResolverService implements Resolve < any > 

constructor(
private projectsService: ProjectsService,
private router: Router
)

resolve(route: ActivatedRouteSnapshot)
const id = +route.paramMap.get('issueId');
return this.projectsService.getProjectTask(id)
.pipe(
map((task: any) =>
console.log(task);
return task
)
);





parent



export class ProjectNameResolverService 

constructor()
resolve(route: ActivatedRouteSnapshot)
console.log(route.firstChild.firstChild.data) // - but need to get it











share|improve this question
















I need to get access from 1 resolve guardian to another (from parent to child), where "another"(child) has async data, so how i can take this async data from child route to parent route



Here is some code



path



const routes: Route = [
path: '', redirectTo: 'main', pathMatch: 'full' ,
path: 'main', component: MainComponent ,
path: 'project',
component: ProjectContainerComponent,
children: [

path: ':id',
component: ProjectComponent,
data:
projectTitle: 'Все задачи',
groupBy: 'Без группировки'
,
resolve:
projectName: ProjectNameResolverService
,
children: [
path: '', redirectTo: 'list', pathMatch: 'full',
path: 'list', component: ProjectIssueListContainerComponent, children: [
path: '', component: ProjectIssueListComponent ,
path: ':issueId', component: ProjectIssueContainerComponent,
resolve:
task: IssueResolverService


] ,
path: 'create', component: CreateIssueComponent ,

]

]
,
path: 'access_denied', component: AccessDeniedComponent
]


child



export class IssueResolverService implements Resolve < any > 

constructor(
private projectsService: ProjectsService,
private router: Router
)

resolve(route: ActivatedRouteSnapshot)
const id = +route.paramMap.get('issueId');
return this.projectsService.getProjectTask(id)
.pipe(
map((task: any) =>
console.log(task);
return task
)
);





parent



export class ProjectNameResolverService 

constructor()
resolve(route: ActivatedRouteSnapshot)
console.log(route.firstChild.firstChild.data) // - but need to get it








angular router guard resolve






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 14:33









SiddAjmera

16.2k31240




16.2k31240










asked Nov 16 '18 at 14:30









Den KernyDen Kerny

47




47












  • Pass data may be using service

    – Pardeep Jain
    Nov 16 '18 at 17:45











  • at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

    – Den Kerny
    Nov 19 '18 at 8:02











  • get it between resolvers, thx

    – Den Kerny
    Nov 19 '18 at 8:25











  • but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

    – Den Kerny
    Nov 19 '18 at 8:30











  • and i cant pass data to component because of subscribe, i dont return smth except Subscriber

    – Den Kerny
    Nov 19 '18 at 8:47

















  • Pass data may be using service

    – Pardeep Jain
    Nov 16 '18 at 17:45











  • at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

    – Den Kerny
    Nov 19 '18 at 8:02











  • get it between resolvers, thx

    – Den Kerny
    Nov 19 '18 at 8:25











  • but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

    – Den Kerny
    Nov 19 '18 at 8:30











  • and i cant pass data to component because of subscribe, i dont return smth except Subscriber

    – Den Kerny
    Nov 19 '18 at 8:47
















Pass data may be using service

– Pardeep Jain
Nov 16 '18 at 17:45





Pass data may be using service

– Pardeep Jain
Nov 16 '18 at 17:45













at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

– Den Kerny
Nov 19 '18 at 8:02





at least i cant pass it with service, i think it is because of the order of loading components - if i pass it from resolver to component(pass it as subject and get it like asObservable), or how i must to do it?

– Den Kerny
Nov 19 '18 at 8:02













get it between resolvers, thx

– Den Kerny
Nov 19 '18 at 8:25





get it between resolvers, thx

– Den Kerny
Nov 19 '18 at 8:25













but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

– Den Kerny
Nov 19 '18 at 8:30





but now i have a problem, i've subscribed to emitting data on resolver and resolver cant unsubscribed as i think(tested ngOnDestroy), how i can unsubscribe from it?

– Den Kerny
Nov 19 '18 at 8:30













and i cant pass data to component because of subscribe, i dont return smth except Subscriber

– Den Kerny
Nov 19 '18 at 8:47





and i cant pass data to component because of subscribe, i dont return smth except Subscriber

– Den Kerny
Nov 19 '18 at 8:47












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339809%2fmultiple-resolve-guards-access-to-each-from-any-route-path%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339809%2fmultiple-resolve-guards-access-to-each-from-any-route-path%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線