search

Home  >  Q&A  >  body text

angular.js - How does the loader in ng2's routeConfig dynamically load modules?

In angular1, the corresponding controller and template can be loaded according to the routeparam. There is a loader method in the routeconfig of ng2. The document mentions promise. I don’t know how to get the routeparam to dynamically load the component?

漂亮男人漂亮男人2796 days ago542

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-05-15 17:03:06

    Modification:
    http://stackoverflow.com/questions/34842536/implementing-dynamic-routing-in-angular2-typescript

    The code below is asynchronous loading, not dynamic loading.

    { path: '/reviewTask', loader: () => require('./review/review')('ReviewTask'), name: 'ReviewTask'},

    reply
    0
  • Cancelreply