0

The question is pretty short: is this possible to run a schematic without the CLI, meaning within my code? Like so:

import { Component} from '@angular/core';

@Component({
  selector: 'app-name',
  templateUrl: './name.component.html',
  styleUrls: ['./name.component.scss']
})
export class NameComponent  {

  myMethod() {
    runSchematic(
      {
        type: 'generate component',
        name: 'my-component'
      }
    );

  }
}

This is obvioulsy some pseudo code I just wrote, the question is mainly about the possibility of running schematics programmatically. Thanks!

KevinTale
  • 1,658
  • 3
  • 25
  • 47
  • I am a bit confused about why you would want to do that. Generating schematics is only usefull when you're developping an app. Even if you want an app that builds apps you wouldn't need to generate schematics inside a component. – YounesM Feb 14 '20 at 14:56
  • I want to try to make a visual coding system out of the angular CLI – KevinTale Feb 14 '20 at 14:58
  • 1
    I don't think you can (or rather want to) do everything with Angular. Let Angular handle the GUI aspects of your app and have a serverside/desktop app that uses that GUI to generate schematics and access files. – YounesM Feb 14 '20 at 15:04

0 Answers0