Hello I am migrating an application from AngularJs to Angular8, following angular io guide upgrade and google, but I pass from one error to another ... (without understanding exactly what is missing) A tsc --build C: \ medanitofnd \ tsconfig.json compiles correctly The file systemjs.config.js indicates an error, although I think I have it as the documentation indicates.
The application is in C:\aplicafnd C:\aplicafnd\package.json C:\aplicafnd\tsconfig.json C:\aplicafnd\app\index.html C:\aplicafnd\app\app.component.ts C:\aplicafnd\app\app.component.spec.ts C:\aplicafnd\app\app.module.ajs.ts #modulee anghularJS C:\aplicafnd\app\app.module.ts C:\aplicafnd\app\main.ts C:\aplicafnd\app\XXX\ #where XXX are the different modules / services Thank you if you can guide me to solve the error. The files can be seen in Thank you. Sorry for my english translate.google.com app.module.ajs.js:5 Uncaught ReferenceError: require is not defined at app.module.ajs.js:5 (anonymous) @ app.module.ajs.js:5 app.module.js:9 Uncaught ReferenceError: require is not defined at app.module.js:9 (anonymous) @ app.module.js:9 main.js:6 Uncaught ReferenceError: require is not defined at main.js:6 (anonymous) @ main.js:6 angular.js:38 Uncaught Error: [$injector:nomod] http://errors.angularjs.org/1.5.11/$injector/nomod?p0=medanito at angular.js:38 at angular.js:2133 at b (angular.js:2057) at Object.module (angular.js:2131) at config.js:207 (anonymous) @ angular.js:38 (anonymous) @ angular.js:2133 b @ angular.js:2057 (anonymous) @ angular.js:2131 (anonymous) @ config.js:207 angular.js:38 Uncaught Error: [$injector:nomod] http://errors.angularjs.org/1.5.11/$injector/nomod?p0=medanito at angular.js:38 at angular.js:2133 at b (angular.js:2057) at Object.module (angular.js:2131) at directives.js:167 -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/cc42b143-4fc0-4f8e-9e61-0ee2c1f0f128%40googlegroups.com.
package.json
Description: application/json
tsconfig.json
Description: application/json
//app.component.spec.ts import { AppComponent } from './app.component'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; describe('AppComponent', function () { let de: DebugElement; let comp: AppComponent; let fixture: ComponentFixture<AppComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AppComponent); comp = fixture.componentInstance; de = fixture.debugElement.query(By.css('h1')); }); it('should create component', () => expect(comp).toBeDefined() ); it('should have expected <h1> text', () => { fixture.detectChanges(); const h1 = de.nativeElement; expect(h1.innerText).toMatch(/angular/i, '<h1> should say something about "Angular"'); }); });
//app.component.ts import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<h1>Hello {{name}}</h1>` }) export class AppComponent { name = 'Angular'; }
//app.module.ajs.ts // fallaimport angular from 'angular'; import * as angular from 'angular'; //import 'angular-route'; import 'jquery'; import 'lodash'; //import 'bootstrap/dist/css/bootstrap.min.css' //import "./styles/app.scss"; const MODULE_NAME = 'aplica'; (function () { angular.module('aplica', [ // angular.module(MODULE_NAME, [ 'ui.router', 'ui.bootstrap', 'ngHandsontable', 'schemaForm', 'aplica.services', 'grid', 'exportacionxls', 'form', 'importacionxls', 'formPer', 'procesos', 'usuarios', 'coremain', 'menu', 'grid.filtros', 'aplica.filters', 'ngFileSaver', 'ngStorage', 'hSweetAlert', 'angular-toArrayFilter' // 'ceibo.components.table.export', // 'aplica.controllers' ]); })(); export default MODULE_NAME;
//app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { UpgradeModule } from '@angular/upgrade/static'; //import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppComponent } from './app.component'; import moduleName from './app.module.ajs'; //traer moduleName desde angularJS @NgModule({ imports: [ BrowserModule, UpgradeModule, ], }) export class AppModule { constructor(private upgrade: UpgradeModule) { } ngDoBootstrap() { this.upgrade.bootstrap(document.documentElement, ['medanito']); } }
//main.ts //import 'zone.js'; //import 'reflect-metadata'; //import angular from 'angular'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app.module'; platformBrowserDynamic().bootstrapModule(AppModule);//index.html