systemjs

How to import a npm package in an angular2 component?

我怕爱的太早我们不能终老 提交于 2019-12-10 01:54:55
问题 I'm trying to learn the ropes of ng2 and the depedency injection system is killing me. I'm using the ng quickstart from: https://github.com/angular/quickstart/blob/master/README.md I'm trying to import this package into the app: https://www.npmjs.com/package/arpad. I installed the package via npm update, my package.json dependencies look like this: "dependencies": { "angular2": "2.0.0-beta.9", "systemjs": "0.19.24", "es6-promise": "^3.0.2", "es6-shim": "^0.35.0", "reflect-metadata": "0.1.2",

“Unexpected token export” in Angular app with SystemJS and TypeScript

瘦欲@ 提交于 2019-12-09 18:34:09
问题 Problem: mysterious "Unexpected token export" I happened to get this error in an Angular example running in plunker where SystemJS transpiles TypeScript code in the browser. There was nothing wrong with the code which ran fine locally . 回答1: Solution This isn't an Angular problem. It's a problem with transpiling certain kinds of TypeScript files in the browser. In my case, I tracked the problem down to a single file that only exported an abstract class . // Class used as a "narrowing"

How to use UMD in browser without any additional dependencies

谁都会走 提交于 2019-12-09 14:14:41
问题 Suppose I have an UMD module like this (saved in 'js/mymodule.js' ): (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.mymodule = global.mymodule || {}))); }(this, function (exports) { 'use strict'; function myFunction() { console.log('hello world'); } })); How can I use this module in an HTML file like this? (without requirejs, commonjs,

Importing CSS and controlling order in <head> using jspm and system.js

假如想象 提交于 2019-12-09 05:42:39
问题 I've written the following in an Aurelia app import "bootstrap/css/bootstrap.css!"; import "./app.css!"; and I want app.css second in since it overrides bootstrap.css styles. However, I'm getting app.css first since I presume the system.js loader is running them in parallel and since app.css is the smaller of the two it gets loaded first. Is there a way in jspm to define a dependency between these two files to control their loading order is is there some other way? Many thanks in advance! :)

WebStorm to import from index file when using SystemJS module system

人盡茶涼 提交于 2019-12-08 19:51:18
问题 Suppose I have the following source structure. /home home.component.ts /shared /domain car.domain.ts house.domain.ts person.domain.ts index.ts All the domain files contains something like export interface Car { someProperty: number; } The index file looks like this export * from './car.domain'; export * from './house.domain'; export * from './person.domain'; Then in works perfectly fine to import like this in my home component. import { Car, Person } from '../shared/domain'; or import { Car,

Angular2.0 in subdirectory, SystemJS cant import angular components

℡╲_俬逩灬. 提交于 2019-12-08 16:22:47
问题 I am getting started with Angular2.0. I have been following the 5 Min Quickstart and everything works fine although I am using grunt to compile my Typescript and some Sass etc. I just have one problem I cant solve by myself. I want to move all the public files (generated Javascript and production node modules into a subdirectory. I need to have that, because I run different applications unter the same domian. The frontend depends on the user type that logged in. (backend is written with

Issues getting Karma to work with SystemJS, Angular2 and Typescript

拈花ヽ惹草 提交于 2019-12-08 15:09:37
问题 I am facing issues getting Karma to work with SystemJS, Angular2 and Typescript. Here is my karma.conf.js: 'use strict'; module.exports = function (config) { config.set({ // base path, that will be used to resolve files and exclude basePath: '.', // frameworks to use frameworks: ['systemjs', 'jasmine'], plugins: ['karma-systemjs', 'karma-jasmine', 'karma-phantomjs-launcher'], files: [ 'node_modules/reflect-metadata/Reflect.js', 'app/**/*.spec.ts', //'jspm_packages/system-polyfills.js', 'karma

How could I use a system.import() into component angular 2

限于喜欢 提交于 2019-12-08 15:07:31
问题 I saw in this post that you can use SystemJS to load external javascript files into my components in Angular 2. In my index.html : <script> System.config({ packages: { "frontOfficeA2/src": { format: 'register', defaultExtension: 'js' }, "angular2-jwt": { "defaultExtension": "js" }, "ng2-bootstrap": { "defaultExtension": "js" }, "system": { "defaultExtension": "js" } }, map: { "angular2-jwt": "lib/angular2-jwt", "ng2-bootstrap": "lib/ng2-bootstrap", "moment": 'lib/moment/moment.js', "system":

Where to put the import module in a new installation of ng-2 Bootstrap?

只谈情不闲聊 提交于 2019-12-08 13:09:28
问题 I'm a complete newbie attempting to setup ng2 Bootstrap (Angular2 with Bootstrap4 css) using this tutorial, so far I've installed the dependencies: Angular (requires Angular version 2 or higher, tested with 2.0-rc.5) Bootstrap CSS (tested with version 4.0 alpha V3) and I've started the application: The problem is I don't know where to add the following line of code without causing errors: Once installed you need to import our main module. import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

Angular2 2.4 How to load external libraries sush as Underscore into angular2.

折月煮酒 提交于 2019-12-08 10:12:16
问题 I created an app with angular-cli and I need to import external libraries such as underscore. I'm new to angular 2.4 and haven't used SystemJS nor Webpack before. Can someone give me a step by step guid of how to load underscore into my angular 2.4 project. A link to github with a project created with angular-cli "latest version" with underscore would make me super happy. Reading code is nice ;) ---- Following is just to describe what makes me confused ------ From my research I found 2