Krishnan Mudaliar
1 min readApr 28, 2019

--

Hi Tomas, wonderful and comprehensive article! Helped me understand not only how to work with a Schematics project but also how to use it in an Angular project without publishing it on npm.

Quick question: I am working on creating a scaffoldable module containing a bunch of components in it. The module is supposed to be a lazy-loaded one, so I want the schematics to add a route automatically to an existing module (as specified by a module property). I’m done with creating the property, finding and creating a “source” object for the “-routing.module”.

Now I want to insert the route in it. How do I do this?

I found a few functions in @schematics/angular/json-utils library that supposedly allow me to edit a “node”. What I am not able to figure out is, how to read the source content and get that “JsonAstObject”. Is this even the right approach?

Any help would be great. Thanks!!

--

--

Krishnan Mudaliar
Krishnan Mudaliar

Written by Krishnan Mudaliar

Loves the web • DIY • DRY • ASP.NET • JavaScript • Angular • NodeJS (i/bitsy) • Believer of great UX

Responses (1)