systemjs

How write single url for angular 2 component templateUrl for SystemJS and Webpack?

偶尔善良 提交于 2020-01-04 11:01:27
问题 I find out that for SystemJS and Webpack project builds in Angular2 @Component templateUrls string must be different. For SystemJS: @Component({ selector: 'home' templateUrl: './app/home/home.component.html' }) export class HomeComponent implements OnInit, OnDestroy { ... } For Webpack: @Component({ selector: 'home' templateUrl: './home.component.html' }) export class HomeComponent implements OnInit, OnDestroy { ... } For SystemJS build templateUrl string must be full path from root. For

What is the correct syntax for importing JSNLog using ES6?

我是研究僧i 提交于 2020-01-04 02:45:29
问题 I can't seem to figure out how to import JSNLog into my ES6 (babel) based Aurelia project. I've tried: import 'jsnlog'; // JL is undefined import JL from 'jsnlog'; // JL is {} import {JL} from 'jsnlog'; // JL is undefined If it matters I've learned that the jsnlog.js file is generated from typescript source. 回答1: The author has fixed this issue with the v2.17.1 release. 回答2: I am the author of JSNLog. Just added info to the jsnlog.com site about using ES6 import to import JSNLog into an ES6

Chart.js moment locale

限于喜欢 提交于 2020-01-03 15:34:24
问题 I'm building an Angular 2 app and use Chart.js 2.0 to display 'time' data. Unfortunately I am not able to change the locale of moment.js. I npm installed moment and import moment.js and pl.js using SystemJS, but Chart.js complains that moment.js has to be loaded before Chart.js (not sure how to accomplish that, in every source file moment is declared before chartjs). Then I tried the Chart.bundle.min.js (with moment included), which works but only in english. I am not able to change the

How to build angular2 app for production

柔情痞子 提交于 2020-01-03 05:38:08
问题 I've complete the angular2 tour of heroes . And I wonder what if I'd like to build this project for production. I want to add only 2 files to index.html : appScripts.js and vendorScripts.js . I've compiled my ts files with option outFile so I have my appScripts.js but it doesn't work. Here is some code in my gulpfile: gulp.task('compile', ['clean'], function() { var tsProject = typescript.createProject('tsconfig.json', { outFile: 'app.js' }); var tsResult = gulp.src(['app/**/*.ts']) .pipe

Importing visionmedia debug in Angular 2 app with System.js and how to log messages?

本秂侑毒 提交于 2020-01-02 21:56:14
问题 I am working on a MEAN stack app with Angular 2 frontend. I have successfully used debug in the express app. However I am unable to cleanly import debug in app.components.ts or main.module.ts . Any idea on how to proceed? <script src="/node_modules/debug/debug.js"></script> Results in error: Uncaught ReferenceError: module is not defined <script>System.import('./node_modules/debug/debug.js');</script> Not good either: zone.js:101 GET http://localhost:8002/ms.js 404 (Not Found) Some dependency

How to import external NPM module with Typescript declarations using JSPM

放肆的年华 提交于 2020-01-02 07:56:26
问题 'test-module' is external module written in Typescript with index.d.ts definition file. it has properties for tsd/tsc in package.json: "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" } 'test-module' is installed with JSPM in jspm_packages/npm/test-module for dynamic loading using SystemJS 'app' is Typescript application that imports 'test-module' like this: import {Component} from 'test-module'; The problem is that 'test-module' module HAS TO BE in both locations

Uncaught TypeError: System.import is not a function

只谈情不闲聊 提交于 2019-12-30 18:45:40
问题 This code is supposed to display a div containing Hello World, but instead I receive the error Uncaught TypeError: System.import is not a function . I'm following the getting started tutorial video for ng-book2, which contains the following code in index.html : <!DOCTYPE html> <html> <head> <title>Angular 2</title> <script src="js/traceur-runtime-0.0.90.js"></script> <script src="js/system-0.18.4.js"></script> <script src="js/angular2-alpha31.js"></script> </head> <body> <script>System.import

How to bundle Angular2 RC1 with systemjs

╄→尐↘猪︶ㄣ 提交于 2019-12-30 05:56:33
问题 Prior to the release candidates angular supplied a bundled file. Since the release candidates there's no more bundled file. Including angular2 and rxjs my app now makes 671 requests over 7secs to load. This has crippled development. Does anyone know how to bundle angular and rxjs and include these in system.config? 回答1: In order to get a lighter weight project you should check SystemJS Builder or JSPM to bundle your project. Example seed project: https://github.com/madhukard/angular2-jspm

How to create an angular 2 build folder when using systemjs.config.js

筅森魡賤 提交于 2019-12-29 06:15:40
问题 How to create an angular 2 build folder when using systemjs.config.js My app works fine locally. I need help with my gulp file so I can grab the node modules required and move them to the dist folder ready for deployment. This is my gulp folder: const gulp = require('gulp'); const ts = require('gulp-typescript'); const uglify = require('gulp-uglify'); const concat = require('gulp-concat'); var htmlreplace = require('gulp-html-replace'); var addsrc = require('gulp-add-src'); var sass = require

Angular no provider for NameService

喜你入骨 提交于 2019-12-28 02:24:45
问题 I've got a problem loading a class into an Angular component. I've been trying to solve it for a long time; I've even tried joining it all in a single file. What I have is: Application.ts /// <reference path="../typings/angular2/angular2.d.ts" /> import {Component,View,bootstrap,NgFor} from "angular2/angular2"; import {NameService} from "./services/NameService"; @Component({ selector:'my-app', injectables: [NameService] }) @View({ template:'<h1>Hi {{name}}</h1>' + '<p>Friends</p>' + '<ul>' +