ng generate service example

Example 1: angular create a service

>>> ng generate service service_name
or
>>> ng generate service /folder-name/service-name

Example 2: ng generate service

// in terminal
// add Service to (new) Service dir

ng g s Services/<serviceName>

Example 3: ng g

ng g directive <name> [options]

Example 4: ng service generate

content_copy1
      
      import { Hero } from './hero';
import { HEROES } from './mock-heroes';

Example 5: angular cli interface generate

ng generate interface <name> <type> [options]
ng g interface <name> <type> [options]

# <name>	The name of the interface.
# <type>	Adds a developer-defined type to the filename, in the format "name.type.ts".
# [options]
#	--lintFix=true|false	When true, applies lint fixes after generating the interface (Default: false)
#	--prefix=prefix			A prefix to apply to generated selectors
#	--project=project		The name of the project.

# e.g.
# ng generate interface Itest sometype		generates file name		itest.sometype.ts