search

Home  >  Q&A  >  body text

angular.js - ng2的routeConfig中的loader怎么动态加载模块

angular1中可以根据routeparam加载相应的controller和template, ng2的routeconfig中有个loader方法, 文档提到promise, 不知道怎么取到routeparam来动态加载component?

漂亮男人漂亮男人2744 days ago513

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