forms - Paths/links with unique ID's angular2 -


i'm creating quiz making/sharing website using angular2 not sure how share quizzes. thinking of using each of quizzes identifiers urls. quizzes made using forms , saved on docmentdb json. have unique id's identify them. ideas how this?

those urls must dynamically created, new quizzes can submitted , thereafter accessed.

you can use same base url page quiz, differentiate quizzes path parameter like:

quizsite.com/#/quiz/12    (12 being quiz id) 

inside component can read path parameters located in url , values accessing activateroute object:

component

import { component } '@angular/core'; import { activatedroute } '@angular/router';  @component({     templateurl: 'quizcomponent.html', }) export class quizcomponent {      constructor(private activatedroute: activatedroute){}       ngoninit() {          // reason being observable can watch              parameter changing (manually in url, or programmatically)              , without page refresh, read new parameter , change quiz           this.activatedroute.params.subscribe(params => {             console.log(params.quizid);             // parameter can make call rest api , return                    data quiz           });     } } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -