angular2-modules

npm run start working whereas ng serve not working

假如想象 提交于 2021-02-09 11:49:05
问题 I try to run angular 2 app with ng serve in Linux machine. It is not working. But I tried npm run start command. It is working fine. I got the following message when I tried ng serve command. As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release, which will only support Node 6.9 and greater. This package will be officially deprecated shortly after. To disable this warning use "ng set --global warnings.packageDeprecation=false". You have to be inside an

Angular 2 difference between core and feature modules

情到浓时终转凉″ 提交于 2019-12-31 09:20:55
问题 I don't understand the difference between core and feature modules in angular 2. As far as I understand there are three recommended types of modules: core, feature and shared. If a module exports some declarations (components, directives and pipes) and many modules will import this module, then this module should be a shared module (in shared directory). If a module expors some declarations (components, directives and pipes) and only the root module will import this module, then this module

Angular 2 difference between core and feature modules

这一生的挚爱 提交于 2019-12-31 09:20:43
问题 I don't understand the difference between core and feature modules in angular 2. As far as I understand there are three recommended types of modules: core, feature and shared. If a module exports some declarations (components, directives and pipes) and many modules will import this module, then this module should be a shared module (in shared directory). If a module expors some declarations (components, directives and pipes) and only the root module will import this module, then this module

Angular4 - use components service in guard

不羁岁月 提交于 2019-12-24 09:57:08
问题 I have a lazy-loaded-module with a root and child componets. I also have a service to share data between the root and the child components and siblings. The use case behind is a wizard, where the user can set some data in multiple steps. The data of each step is stored globally in the service, so that the parent and every child component is able to access the whole data. Now i want to create guards for the single steps, which should check if the step before was done (data in the service is

Angular2 RC5 Cross-Module Provider / Scanning

浪尽此生 提交于 2019-12-24 00:23:41
问题 I'm working on a project which is currently Angular RC5 and Material Design latest. Not that the last part is relevant. I'm starting to create separate modules and move away from having everything in the main Module because of obvious reasons. I however, need to have Providers which are shared across all modules. F/E I have a service which does the final connection to our Back end System. Url's etc. for different modules are set on separate providers. All these services are currently part of

Angular 2 - Exporting Auth Services from AuthModule to AppModule

早过忘川 提交于 2019-12-23 07:40:15
问题 I decided to put LoginComponent, AuthService, LoggedInGuard inside a module called AuthModule: import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { AuthComponent } from './auth.component'; import { LoginComponent } from './components/login/login.component'; import { AuthService } from './services/auth/auth.service'; import { StorageService } from './services/storage/storage.service'; import { RequestService } from './services/request/request

Having trouble exporting from an Angular2 module

半腔热情 提交于 2019-12-22 18:33:22
问题 I'm a beginner with Angular 2, and am trying to understand how to export a class from a feature module, and import it into my main module. When I try to compile this in typescript, I receive the following two errors: app/app.component.ts(11,21): error TS2304: Cannot find name 'AddService'. app/app.module.ts(4,9): error TS2305: Module '"C:/angular/app/add/arithmetic.module"' has no exported member 'AddService'. my tree is simple: / index.html package.json systemjs.config.js tsconfig.json

Angular 2 global component

耗尽温柔 提交于 2019-12-22 11:32:38
问题 My structure is as follows : App *component, module, template* Component 1 *component, module, template* Component 11 *component, module, template* Global Component *component, temaplte, BUT NO MODULE* My App module contains the component 1 and component 11 modules. I declared the global component in the app module, so that I can use it in all my other components. I also exported it in app module. But when I use the selector in the component 11 template, the console says not a known element .