EzDev.org

angular-seed

angular-seed - Extensible, reliable, modular, PWA ready starter project for Angular (2 and beyond) with statically typed build and AoT compilation Angular Seed


How to see $log calls in Terminal when running angularjs unit tests with karma?

In a project based on angular-seed project, I am running unit tests with ./scripts/test.sh --log-level debug but none of the log messages that I see are coming from my app. How do I get to see them? In my app, I am logging with $log.


Source: (StackOverflow)

How to import Angular Seed project in IntelliJ

I'm trying to import the Angular Seed project into IntelliJ, but when I do it creates a whole bunch of individual modules. I just want a view of the directory structure and to forget about this module junk. All they are are folders to me.

How can I set this up in IntelliJ? Is this something people do with Angular applications or do I need to change to something like WebStorm instead?


Source: (StackOverflow)

Experimental support for decorators is a feature that is subject to change in a future release

I just cloned angular2-seed project from github and followed the steps, but i got this warning into VS code [ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'Exxperimentaldecorators' option to remove this warning.


Source: (StackOverflow)

Clear service data in AngularJs

I'm trying to store data in my services similar to the answer in :

Processing $http response in service

app.factory('myService', function($http) {
  var promise;
  var myService = {
    async: function() {
      if ( !promise ) {
        // $http returns a promise, which has a then function, which also returns a promise
        promise = $http.get('test.json').then(function (response) {
          // The then function here is an opportunity to modify the response
          console.log(response);
          // The return value gets picked up by the then in the controller.
          return response.data;
        });
      }
      // Return the promise to the controller
      return promise;
    }
  };
  return myService;
});

app.controller('MainCtrl', function( myService,$scope) {
  $scope.clearData = function() {
    $scope.data = {};
  };
  $scope.getData = function() {
    // Call the async method and then do stuff with what is returned inside our own then function
    myService.async().then(function(d) {
      $scope.data = d;
    });
  };
});

However, I noticed that the data in my services persists even after logout. Thus I could login as a completely different user and see data which I should not see.

How can I clear data after logout? Sure I could manually clear everything in all my services, but I am looking for a more general approach such as "clear all user data". I have tried to force a page refresh, and it works, but I don't like the flash it produces.

edit: Code from example


Source: (StackOverflow)

AngularJS App: How to include .js files into index.html

I'm new to angularJS. I managed to build a phonegap app using angularJS. The app is ok and running just fine. The problem is, now that I have a little more understanding on how angularJS works (at least I think I have), I'm worried about my app files structure and code maintainability. My project follows the angular-seed pattern. Angular Seed on GitHub where I have this structure:

js
   app.js
   controllers.js
   directives.js
   services.js
   filters.js

After researching how to structure apps with angularJS, I've found some very nice articles about it: Building Huuuuuge Apps with AngularJS and HOW TO STRUCTURE LARGE ANGULARJS APPLICATIONS

My question seems very silly to me but I couldn't find a way out. I managed to separate my controllers into different files and I have now this structure:

scripts
    controllers
             LoginCtrl.js
             HomeCtrl.js
             AboutCtrl.js
             ClientCtrl.js 

The thing that I'm struggling with is that in the way that my app was before, I had only one controller.js file. In my index.html file, I load all the script files normally using the script tag. Now that I have 4 different .js files for my controllers, how do I load them into my index.html file? Do I have to load them all there?

It doesn't look right to me load all the scripts in the index.html file like that (I know that having one file the code will be loaded in the same way, it is just weird to me having many script tags packed there). I've found the ng-boilerplate project on github and on their index.html they load the scripts kind of dynamically. The problem is, I can't start a new ng-bolierplate right now, and I couldn't find how they did it. Sorry for the long text. Thanks!


Source: (StackOverflow)

'http-server' is not recognized as an internal or external command

After installing angular-seed project, i did the following steps:

Cloned the repository :

git clone https://github.com/angular/angular-seed.git

cd angular-seed

Then I ran npm install

at the end of the install i get:

angular-seed@0.0.0 prestart C:\Users\user\Documents\GitHub\comilion\angular-seed npm install

angular-seed@0.0.0 postinstall C:\Users\user\Documents\GitHub\myproject\angular-seed bower install

angular-seed@0.0.0 start C:\Users\user\Documents\GitHub\myproject\angular-seed http-server -a localhost -p 2324

'http-server' is not recognized as an internal or external command, operable program or batch file.

npm ERR! angular-seed@0.0.0 start: http-server -a localhost -p 2324 npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular-seed@0.0.0 start script. npm ERR! This is most likely a problem with the angular-seed package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR!
http-server -a localhost -p 2324 npm ERR! You can get their info via: npm ERR! npm owner ls angular-seed npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! cwd C:\Users\user\Documents\GitHub\myproject\angular-seed npm ERR! node -v v0.10.22 npm ERR! npm -v 1.3.14 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR!
C:\Users\user\Documents\GitHub\myproject\angular-seed\npm-debug.log

please let me know if you have any suggestions how to solve this issue.


Source: (StackOverflow)

Executed 0 of 0 ERROR while running unit tests

Im getting Executed 0 of 0 ERROR error when trying to run unit test cases. I followed few solutions that was mentioned for this problem, but still i get the same error.

Tried:

  1. Removing the angular-scenario file
  2. Added angular-scenario in exclusion list.

But nothing worked. I still get the same error. My karma.conf.js file is

module.exports = function(config){
    config.set({
    basePath : '../',

    files : [      
      'app/lib/angular/angular.js',      
      'test/lib/angular/angular-mocks.js',
      'app/js/*.js',
      'test/unit/*.js'
    ],
    exclude : ['test/lib/angular/angular-scenario.js'],
    autoWatch : true,

    frameworks: ['jasmine'],

    browsers : ['Chrome'],

    plugins : [
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine'       
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

})}

Source: (StackOverflow)

Get a parameter from HTML before loading is complete

I have an Angular application based on Seed. I want it to wait for the loading of all data before displaying anything. That is done with a provider in my app.module.ts:

providers: [
  AlbumConfig,
  UserConfig,
  {
    provide: APP_INITIALIZER,
    useFactory: (config: AlbumConfig) => () => config.load(),
    deps: [AlbumConfig],
    multi: true
  }
],

Problem is the config.load (which eventually fires a resolve(true)) needs an id given in the HTML page by the server:

<rmalbum-app data-id="<?php print $album_id; ?>">Loading...</rmalbum-app>

The only way I found to get this parameter is in the app.component's constructor:

albumConfig.id= this.elementRef.nativeElement.getAttribute('data-id');

The problem is that this constructor is only called after the initialization.

So I either have, chronologically:

  • config.load()
  • "Loading..." disappears
  • app.component's constructor is called, I get the id, too late for config.load

or, if I remove the APP_INITIALIZER and put the config.load() in the component's constructor:

  • "Loading..." disappears
  • app.component's constructor is called, I get the id
  • config.load() manually called from the constructor

I don't want that because it means the application is displayed before the config is actually loaded.


Source: (StackOverflow)

Angular2 Router: add hashtag to url

I'm using Angular2 Seed application, and you can find it in the official repo. As you can see, here we have angular2/router imported, and we're using it to create the basic routing of the application.

import {Component, ViewEncapsulation} from 'angular2/angular2';
import {
  RouteConfig,
  ROUTER_DIRECTIVES
} from 'angular2/router';
...
@RouteConfig([
  { path: '/', component: HomeCmp, as: 'Home' },
  { path: '/about', component: AboutCmp, as: 'About' }
])
export class AppCmp {}

My question is: how can I configure router to add hashtag in my url, to make it looks like: localhost:5555/#/about. Is there any beautiful and easy way to make it? (as earlier with $locationProvider)

I know it's bizarre, but I used to love this hashtag in url, and my apache-config also used to love it. Of course, I can change my httpd.conf file, very easy and properly, but I really want to figure out, how to simply add hashtag, with Angular2 Router.


Source: (StackOverflow)

ng2-validation not working in Angular2 angular-seed

I am trying to integrate ng2-validation in my Angular2 angular-seed based project. I have followed the steps mentioned in the ng2-validation documentation but i am getting following error. Please help me in this regard.

"(SystemJS) Unexpected token <
    SyntaxError: Unexpected token <
        at Object.eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:13:10)
        at eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:43:4)
        at eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:44:3)
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/directives.js
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/index.js
    Evaluating http://localhost:5555/app/app.module.js
    Evaluating http://localhost:5555/app/main.js
    Error loading http://localhost:5555/app/main.js"

Source: (StackOverflow)

ng2-bootstrap btnRadio in angular 2 rc2 seed project. Two-way binding to ngModel is broken?

I'm trying to use the ng2-bootstrap radio-buttons in angular 2 rc2 seed project. The following code works without any problems in our angular 2 rc1 project. Now I'm trying to create a seed project using https://github.com/mgechev/angular2-seed as the base and can't do it properly.

I use ng2-bootstrap radio-buttons directive in following way:

<div class="btn btn-primary" [(ngModel)]="mode" btnRadio="EDITOR" uncheckable> 
     Editor 
</div>

I include the ng2-bootstrap and moment libraries in seed.config.ts. I have tried many variants (also with ng2-bootstrap/ng2-bootstrap etc.)

paths: {
  ...
  'ng2-bootstrap': `${this.NPM_BASE}/ng2-bootstrap/`,
  'moment': `${this.NPM_BASE}moment/`
},
packages: {
    ...
    'ng2-bootstrap': { main: "ng2-bootstrap.js", defaultExtension: 'js' },
    'moment': { main: "moment.js", defaultExtension: 'js' },
}

I import the following directives

import { BUTTON_DIRECTIVES } from 'ng2-bootstrap/ng2-bootstrap';
import { ButtonRadioDirective } from 'ng2-bootstrap/ng2-bootstrap';

And use this by my component

@Component({
  moduleId: module.id,
  selector: "editor",
  templateUrl: "editor.html",
  directives: [FORM_DIRECTIVES, CORE_DIRECTIVES, BUTTON_DIRECTIVES, 
  CodeMirrorComponent, ButtonRadioDirective]
})

I build the project without any problems, but when i run the server, i obtain the following run time exception:

ORIGINAL EXCEPTION: No value accessor for ''

I'm sure the two-way binding to ngModel is broken here. I have used this code with rc1 bundles and without seed project. Now I'm not sure, what can be a problem - new angular version, or using a build system (in my case - gulp).

I hope anybody can help with advice. Many thanks in advance.

Edited since 21.06.2016

The versions of used packages are following:

"dependencies": {
  "@angular/common": "2.0.0-rc.2",
  "@angular/compiler": "2.0.0-rc.2",
  "@angular/core": "2.0.0-rc.2",
  "@angular/forms": "^0.1.0",
  "@angular/platform-browser": "2.0.0-rc.2",
  "@angular/platform-browser-dynamic": "2.0.0-rc.2",
  "@angular/router": "3.0.0-alpha.6",
  "es6-module-loader": "^0.17.8",
  "core-js": "^2.4.0",
  "rxjs": "5.0.0-beta.6",
  "systemjs": "0.19.26",
  "zone.js": "^0.6.12",
  "bootstrap": "^3.3.6",
  "ng2-bootstrap": "^1.0.17"
}

Source: (StackOverflow)

Karma Testing Angular Seed Project System.JS path error

I'm just getting started with Angular using https://github.com/mgechev/angular-seed as my initial setup.

I'm having some problems getting an initial unit test setup with Jasmine. The OAuth library used in my project seems to be the issue, but I'm not sure whether it can be safely suppressed or what changes I need to make to the config. The base/node_modules path is currently incorrect, but I'm not sure which part of the configuration builds this. I've tried adding the path to the ignored section but the error persists. Any help appreciated.

// Karma configuration
// Generated on Wed Jul 15 2015 09:44:02 GMT+0200 (Romance Daylight Time)
'use strict';

var argv = require('yargs').argv;
var minimatch = require("minimatch");


module.exports = function (config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: './',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      // Polyfills.
      'node_modules/core-js/client/shim.min.js',
      'node_modules/intl/dist/Intl.min.js',

      'node_modules/traceur/bin/traceur.js',

      // System.js for module loading
      'node_modules/systemjs/dist/system.src.js',

      // Zone.js dependencies
      'node_modules/zone.js/dist/zone.js',
      'node_modules/zone.js/dist/long-stack-trace-zone.js',
      'node_modules/zone.js/dist/async-test.js',
      'node_modules/zone.js/dist/fake-async-test.js',
      'node_modules/zone.js/dist/sync-test.js',
      'node_modules/zone.js/dist/proxy.js',
      'node_modules/zone.js/dist/jasmine-patch.js',

      // RxJs.
      { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
      { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },

      // paths loaded via module imports
      // Angular itself
      { pattern: 'node_modules/@angular/**/*.js', included: false, watched: true },
      { pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },

      { pattern: 'dist/dev/**/*.js', included: false, watched: true },
      { pattern: 'dist/dev/**/*.html', included: false, watched: true, served: true },
      { pattern: 'dist/dev/**/*.css', included: false, watched: true, served: true },
      { pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it

      // suppress annoying 404 warnings for resources, images, etc.
      { pattern: 'dist/dev/assets/**/*', watched: false, included: false, served: true },

      'test-config.js',
      'dist/dev/app/system-config.js',
      'test-main.js'
    ],

    // must go along with above, suppress annoying 404 warnings.
    proxies: {
      '/assets/': '/base/dist/dev/assets/'
    },

    // list of files to exclude
    exclude: [
      'node_modules/**/*spec.js',
      'node_modules/angular-oauth2-oidc/dist/index.js',
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['mocha'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: [
      'Chrome'
    ],


    customLaunchers: {
      Chrome_travis_ci: {
        base: 'Chrome',
        flags: ['--no-sandbox']
      }
    },


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Passing command line arguments to tests
    client: {
      files:  argv.files ? minimatch.makeRe(argv.files).source : null
    }
  });

  if (process.env.APPVEYOR) {
    config.browsers = ['IE'];
    config.singleRun = true;
    config.browserNoActivityTimeout = 90000; // Note: default value (10000) is not enough
  }

  if (process.env.TRAVIS || process.env.CIRCLECI) {
    config.browsers = ['Chrome_travis_ci'];
    config.singleRun = true;
    config.browserNoActivityTimeout = 90000;
  }
};

The following is the error message :

06 07 2017 09:27:29.589:INFO [karma]: Karma v1.3.0 server started at http://loca
lhost:9876/
06 07 2017 09:27:29.590:INFO [launcher]: Launching browser Chrome with unlimited
 concurrency
06 07 2017 09:27:29.595:INFO [launcher]: Starting browser Chrome
06 07 2017 09:27:31.064:INFO [Chrome 59.0.3071 (Windows 8.1 0.0.0)]: Connected o
n socket /#4mhCO5mVkEwzD0EfAAAA with id 14947625
06 07 2017 09:27:32.242:WARN [web-server]: 404: /base/node_modules/angular-oauth
2-oidc/dist/index.js
Chrome 59.0.3071 (Windows 8.1 0.0.0) ERROR: '(SystemJS) XHR error (404 Not Found
) loading http://localhost:9876/base/node_modules/angular-oauth2-oidc/dist/index
.js
        Error: XHR error (404 Not Found) loading http://localhost:9876/base/node
_modules/angular-oauth2-oidc/dist/index.js
            at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (ht
tp://localhost:9876/base/node_modules/zone.js/dist/zone.js?082dc1d83c7a42ddda9b6
52319d281eef1d450d5:1056:39)
            at ZoneDelegate.invokeTask (http://localhost:9876/base/node_modules/
zone.js/dist/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:424:31)
            at Zone.runTask (http://localhost:9876/base/node_modules/zone.js/dis
t/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:191:47)
            at XMLHttpRequest.ZoneTask.invoke (http://localhost:9876/base/node_m
odules/zone.js/dist/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:486:38)
        Error loading http://localhost:9876/base/node_modules/angular-oauth2-oid
c/dist/index.js as "angular-oauth2-oidc" from http://localhost:9876/base/dist/de
v/app/shared/login/login-service.js'
Chrome 59.0.3071 (Windows 8.1 0.0.0) ERROR: '(SystemJS) XHR error (404 Not Found
) loading http://localhost:9876/base/node_modules/angular-oauth2-oidc/dist/index
.js
        Error: XHR error (404 Not Found) loading http://localhost:9876/base/node
_modules/angular-oauth2-oidc/dist/index.js
            at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (ht
tp://localhost:9876/base/node_modules/zone.js/dist/zone.js?082dc1d83c7a42ddda9b6
52319d281eef1d450d5:1056:39)
            at ZoneDelegate.invokeTask (http://localhost:9876/base/node_modules/
zone.js/dist/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:424:31)
            at Zone.runTask (http://localhost:9876/base/node_modules/zone.js/dis
t/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:191:47)
            at XMLHttpRequest.ZoneTask.invoke (http://localhost:9876/base/node_m
odules/zone.js/dist/zone.js?082dc1d83c7a42ddda9b652319d281eef1d450d5:486:38)
        Error loading http://localhost:9876/base/node_modules/angular-oauth2-oid
c/dist/index.js as "angular-oauth2-oidc" from http://localhost:9876/base/dist/de
v/app/shared/login/login-service.js'
06 07 2017 09:27:32.274:WARN [web-server]: 404: /base/node_modules/angular-oauth
2-oidc/dist/index.js

Update:

After removing the list of files to exclude:

enter image description here


Source: (StackOverflow)

npm + Gulp cannot find module gulp

I have a problem with my angular2-seed project. Executing "npm install" throws the following error:

          throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
                ^
TSError: тип Unable to compile TypeScript
Cannot find type definition file for 'node'. (2688)
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307)
gulpfile.ts (2,23): Cannot find module 'gulp-util'. (2307)
gulpfile.ts (3,30): Cannot find module 'run-sequence'. (2307)
gulpfile.ts (5,20): Cannot find module './tools/config'. (2307)
gulpfile.ts (6,47): Cannot find module './tools/utils'. (2307)

It worked well before I made 'npm install' on clean repo. Now I receive this error and I have no idea whats wrong. Two days ago, it worked without a problem.

Please help.

Gulpfile.ts (it was not changed since last successful build):

import * as gulp from 'gulp';
import * as util from 'gulp-util';
import * as runSequence from 'run-sequence';

import Config from './tools/config';
import { loadTasks, loadCompositeTasks } from './tools/utils';


loadTasks(Config.SEED_TASKS_DIR);
loadTasks(Config.PROJECT_TASKS_DIR);

loadCompositeTasks(Config.SEED_COMPOSITE_TASKS, Config.PROJECT_COMPOSITE_TASKS);


// --------------
// Clean dev/coverage that will only run once
// this prevents karma watchers from being broken when directories are deleted
let firstRun = true;
gulp.task('clean.once', (done: any) => {
  if (firstRun) {
    firstRun = false;
    runSequence('check.tools', 'clean.dev', 'clean.coverage', done);
  } else {
    util.log('Skipping clean on rebuild');
    done();
  }
});

EDIT 1 package.json

{
  "name": "angular-seed",
  "version": "0.0.0",
  "description": "Modular starter project for Angular 2 (and beyond) with statically typed build and AoT compilation",
  "repository": {
    "url": "https://github.com/mgechev/angular-seed"
  },
  "scripts": {
    "build.dev": "gulp build.dev --color --env-config dev",
    "build.dev.watch": "gulp build.dev.watch --color",
    "build.e2e": "gulp build.e2e --color",
    "build.prod": "gulp build.prod --color --env-config prod --build-type prod",
    "build.prod.exp": "gulp build.prod.aot --color --env-config prod --build-type prod",
    "build.prod.rollup.aot": "gulp build.prod.rollup.aot --color --env-config prod --build-type prod",
    "build.prod.aot": "gulp build.prod.aot --color --env-config prod --build-type prod",
    "build.test": "gulp build.test --color",
    "test.watch": "gulp test.watch --color",
    "generate.manifest": "gulp generate.manifest --color",
    "e2e": "protractor",
    "e2e.live": "protractor --elementExplorer",
    "gulp": "gulp",
    "i18n": "ng-xi18n -p src/client/tsconfig.json && gulp clean.i18n",
    "lint": "gulp tslint",
    "karma": "karma",
    "karma.start": "karma start",
    "postinstall": "gulp check.versions && gulp build.bundle.rxjs && npm prune && gulp webdriver && gulp print.banner",
    "reinstall": "npm cache clean && npm install",
    "serve.coverage": "gulp serve.coverage --color",
    "serve.dev": "gulp serve.dev --color --env-config dev",
    "serve.e2e": "gulp serve.e2e --color",
    "serve.prod": "gulp serve.prod --color --env-config prod --build-type prod",
    "serve.prod.aot": "gulp serve.prod.aot --color --env-config prod --build-type prod",
    "serve.prod.exp": "gulp serve.prod.aot --color --env-config prod --build-type prod",
    "serve.prod.rollup.aot": "gulp serve.prod.rollup.aot --color --env-config prod --build-type prod",
    "start": "gulp serve.dev --color",
    "start.deving": "gulp start.deving --color",
    "tasks.list": "gulp --tasks-simple --color",
    "test": "gulp test --color",
    "e2e.ci": "gulp build.prod --color && gulp build.e2e --color && gulp e2e --color",
    "tests.all": "npm test && npm run e2e.ci",
    "webdriver-start": "webdriver-manager start",
    "webdriver-update": "node_modules/protractor/bin/webdriver-manager update",
    "compodoc": "node_modules/.bin/compodoc -p src/client/tsconfig.json",
    "serve.compodoc": "node_modules/.bin/compodoc -s"
  },
  "author": "Minko Gechev <mgechev>",
  "license": "MIT",
  "devDependencies": {
    "@angular/compiler-cli": "^4.0.0",
    "@angular/platform-server": "^4.0.0",
    "@types/async": "^2.0.32",
    "@types/browser-sync": "^0.0.34",
    "@types/express": "^4.0.33",
    "@types/gulp": "^3.8.32",
    "@types/gulp-filter": "^3.0.29",
    "@types/gulp-load-plugins": "^0.0.28",
    "@types/gulp-protractor": "^1.0.29",
    "@types/gulp-sass": "^0.0.29",
    "@types/gulp-util": "^3.0.29",
    "@types/jasmine": "2.5.41",
    "@types/node": "^6.0.45",
    "@types/rimraf": "0.0.28",
    "@types/run-sequence": "^0.0.28",
    "@types/selenium-webdriver": "^2.53.39",
    "@types/systemjs": "^0.19.31",
    "@types/yargs": "^6.5.0",
    "@types/zone.js": "^0.0.27",
    "async": "^2.1.1",
    "autoprefixer": "^6.5.1",
    "browser-sync": "^2.17.3",
    "codelyzer": "^2.1.1",
    "compodoc": "^0.0.40",
    "connect-history-api-fallback": "^1.3.0",
    "cssnano": "^3.7.7",
    "deep-extend": "^0.4.1",
    "event-stream": "^3.3.4",
    "express": "~4.14.0",
    "express-history-api-fallback": "^2.0.0",
    "gulp": "^3.9.1",
    "gulp-cached": "^1.1.0",
    "gulp-concat": "^2.6.0",
    "gulp-concat-css": "^2.3.0",
    "gulp-filter": "^4.0.0",
    "gulp-inject": "^4.1.0",
    "gulp-inline-ng2-template": "^4.0.0",
    "gulp-load-plugins": "^1.3.0",
    "gulp-plumber": "~1.1.0",
    "gulp-postcss": "^6.2.0",
    "gulp-progeny": "^0.3.1",
    "gulp-protractor": "^3.0.0",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^0.5.4",
    "gulp-sass": "^3.0.0",
    "gulp-sourcemaps": "2.2.0",
    "gulp-template": "^4.0.0",
    "gulp-tslint": "7.0.1",
    "gulp-typescript": "^3.0.2",
    "gulp-uglify": "^2.0.0",
    "gulp-util": "^3.0.7",
    "gulp-watch": "^4.3.10",
    "is-ci": "^1.0.9",
    "isstream": "^0.1.2",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "^3.0.0",
    "karma": "~1.3.0",
    "karma-chrome-launcher": "~2.0.0",
    "karma-coverage": "^1.1.1",
    "karma-firefox-launcher": "^1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-mocha-reporter": "^2.2.0",
    "karma-remap-istanbul": "^0.2.1",
    "merge-stream": "^1.0.0",
    "minimatch": "^3.0.3",
    "open": "0.0.5",
    "protractor": "^4.0.14",
    "remap-istanbul": "^0.8.4",
    "rimraf": "^2.5.4",
    "rollup": "^0.41.4",
    "rollup-plugin-commonjs": "^7.0.1",
    "rollup-plugin-includepaths": "0.2.1",
    "rollup-plugin-node-resolve": "^2.0.0",
    "run-sequence": "^1.2.2",
    "semver": "^5.3.0",
    "serve-static": "^1.11.1",
    "slash": "~1.0.0",
    "supports-color": "^3.1.2",
    "systemjs-builder": "0.15.34",
    "tildify": "^1.2.0",
    "traceur": "^0.0.111",
    "ts-node": "^2.0.0",
    "tslint": "^4.3.0",
    "typescript": "^2.1.5",
    "walk": "^2.3.9",
    "yargs": "^6.0.0"
  },
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@angular/service-worker": "^1.0.0-beta.6",
    "angular2-chartjs": "^0.2.0",
    "core-js": "^2.4.1",
    "intl": "^1.2.5",
    "jquery": "1.11.1",
    "material-design-lite": "^1.1.3",
    "ng2-auto-complete": "^0.12.0",
    "ng2-dnd": "2.0.1",
    "ngx-uploader": "^2.2.8",
    "rxjs": "^5.2.0",
    "systemjs": "0.19.41",
    "zone.js": "^0.8.4"
  }
}

Source: (StackOverflow)

No provider for PlatformRef error after upgrading to Angular2 RC5 in IE10

I just upgraded to Angular2 RC5. The app loads fine in all browsers exception IE10. I get an exception "No provider for PlatformRef!" when I bootstrap the application. Everything worked fine in RC4. I saw some posts on the web about this exception, but they were all related to Meteor. I do not use meteor. My project is derived from AngularSeed (previous version that I updated manually to RC5). Any idea on how to fix this? Thanks!

In IE10, I get this error:

No provider for PlatformRef!  
{
  [functions]: ,
  context: <Permission denied>,
  injectors: [ ],
  keys: [ ],
  message: "No provider for PlatformRef!",
  name: "Error",
  stack: undefined,
  Symbol()_m.sovohbnexgu: undefined,
  Symbol()_n.sovohbnexgu: undefined,
  Symbol()_o.sovohbnexgu: undefined,
  Symbol(rxSubscriber)_p.sovohbnexgu: undefined
}

main.ts:

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule }              from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

AppModule:

import { provide, NgModule, ExceptionHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './components/app/app.component';
import { AppExceptionHandler } from './app.exceptionhandler';
import { AppRoutes } from './app.routes';
import { LogService, ... } from './services/';

@NgModule({
    declarations: [AppComponent, ...],
    imports: [BrowserModule,
              RouterModule.forRoot(AppRoutes),
              HttpModule,
              FormsModule],
    providers: [provide(ExceptionHandler, { useClass: AppExceptionHandler }), LogService, ...],
    bootstrap: [AppComponent],
})
export class AppModule { }

Dependencies versions:

  • "@angular/common": "2.0.0-rc.5",
  • "@angular/compiler": "2.0.0-rc.5",
  • "@angular/core": "2.0.0-rc.5",
  • "@angular/forms": "0.3.0",
  • "@angular/http": "2.0.0-rc.5",
  • "@angular/platform-browser": "2.0.0-rc.5",
  • "@angular/platform-browser-dynamic": "2.0.0-rc.5",
  • "@angular/router": "3.0.0-rc.1",
  • "es6-module-loader": "^0.17.8",
  • "core-js": "^2.4.0",
  • "rxjs": "5.0.0-beta.6",
  • "systemjs": "0.19.27",
  • "zone.js": "0.6.13",

Edit: If I try to add PlatformRef to the @NgModule imports, I get this error:

shims.js?1472473326356:4 Uncaught TypeError: Cannot read property 'type' of null(anonymous function) 
@ app.js?1472473326358:5getTransitiveModules 
@ app.js?1472473326358:5CompileMetadataResolver._getTransitiveNgModuleMetadata 
@ app.js?1472473326358:5CompileMetadataResolver.getNgModuleMetadata 
@ app.js?1472473326358:5RuntimeCompiler._compileComponents 
@ app.js?1472473326358:3RuntimeCompiler._compileModuleAndComponents 
@ app.js?1472473326358:3RuntimeCompiler.compileModuleAsync 
@ app.js?1472473326358:3PlatformRef_._bootstrapModuleWithZone 
@ app.js?1472473326358:48PlatformRef_.bootstrapModule 
@ app.js?1472473326358:48bootstrapper 
@ app.js?1472473326358:57(anonymous function) 
[...]

I get this stack on IE:

"TypeError: Unable to get property 'type' of undefined or null reference
   at Anonymous function (eval code:13673:13)
   at Call (http://localhost:5555/node_modules/es6-shim/es6-shim.js?1472473192889:289:7)
   at forEach (http://localhost:5555/node_modules/es6-shim/es6-shim.js?1472473192889:1295:7)
   at getTransitiveModules (eval code:13672:9)
   at CompileMetadataResolver.prototype._getTransitiveNgModuleMetadata (eval code:13387:13)
   at CompileMetadataResolver.prototype.getNgModuleMetadata (eval code:13259:17)
   at RuntimeCompiler.prototype._compileComponents (eval code:15845:13)
   at RuntimeCompiler.prototype._compileModuleAndComponents (eval code:15769:13)
   at RuntimeCompiler.prototype.compileModuleAsync (eval code:15746:13)
   at PlatformRef_.prototype._bootstrapModuleWithZone (eval code:9991:13)"

Source: (StackOverflow)

Controllers are not defined in karma unit test case

i get this error when i run the test cases:

Error: [ng:areq] Argument 'testcont' is not a function, got undefined

This is my ControllerSpec.js

describe('controllers', function(){
  var scope;   
  beforeEach(angular.module('myapp.test'));   
  beforeEach(inject(function($controller, $rootScope){    
    scope = $rootScope.$new();
    $controller('testcont', {$scope:scope});
  }));

  it('should', function(){
      expect(scope.a).toBe(10)      
  })

});

This is my controllers.js

angular.module('myapp.test', [], function () {

}).controller('testcont', function($scope) {
    $scope.a = 10;
});

Log Content

DEBUG [plugin]: Loading plugin karma-junit-reporter.
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-firefox-launcher.
DEBUG [plugin]: Loading plugin karma-jasmine.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [launcher]: Creating temp dir at C:\Users\RAJSUB~1\AppData\Local\Temp\karma-48416683
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\RAJSUB~1\AppData\Local\Temp\karma-48416683 --no-default-browser-check --no-first-run --disable-default-apps --start-maximized http://localh
DEBUG [watcher]: Resolved files:
        C:/inetpub/wwwroot/seed/node_modules/karma-jasmine/lib/jasmine.js
        C:/inetpub/wwwroot/seed/node_modules/karma-jasmine/lib/adapter.js
        C:/inetpub/wwwroot/seed/app/lib/angular/angular.js
        C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js
        C:/inetpub/wwwroot/seed/app/js/app.js
        C:/inetpub/wwwroot/seed/app/js/controllers.js
        C:/inetpub/wwwroot/seed/app/js/directives.js
        C:/inetpub/wwwroot/seed/app/js/filters.js
        C:/inetpub/wwwroot/seed/app/js/services.js
        C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js
        C:/inetpub/wwwroot/seed/test/unit/directivesSpec.js
        C:/inetpub/wwwroot/seed/test/unit/filtersSpec.js
        C:/inetpub/wwwroot/seed/test/unit/servicesSpec.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Watching "C:/inetpub/wwwroot/seed/app/lib/angular/angular.js"
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Watching "C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js"
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Watching "C:/inetpub/wwwroot/seed/app/js"
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Watching "C:/inetpub/wwwroot/seed/test/unit"
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/lib/angular/angular.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js" ignored. Already in the list.
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/test/lib/angular/angular-scenario.js
DEBUG [watcher]: Excluding C:/inetpub/wwwroot/seed/config/karma.conf.js
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/js/filters.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/js/controllers.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/js/app.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/js/services.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/test/unit/directivesSpec.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/test/unit/filtersSpec.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/app/js/directives.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js" ignored. Already in the list.
DEBUG [watcher]: Add file "C:/inetpub/wwwroot/seed/test/unit/servicesSpec.js" ignored. Already in the list.
DEBUG [web-server]: serving: C:\inetpub\wwwroot\seed\node_modules\karma\static/client.html
DEBUG [web-server]: serving: C:\inetpub\wwwroot\seed\node_modules\karma\static/karma.js
DEBUG [karma]: A browser has connected on socket Uj4-OIYPhAr0oyLxH6vm
INFO [Chrome 30.0.1599 (Windows 7)]: Connected on socket Uj4-OIYPhAr0oyLxH6vm
DEBUG [karma]: All browsers are ready, executing
DEBUG [web-server]: serving: C:\inetpub\wwwroot\seed\node_modules\karma\static/context.html
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/node_modules/karma-jasmine/lib/jasmine.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/node_modules/karma-jasmine/lib/adapter.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/js/app.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/js/controllers.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/lib/angular/angular.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/js/filters.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/js/directives.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/test/unit/filtersSpec.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/app/js/services.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/test/unit/directivesSpec.js
DEBUG [web-server]: serving: C:/inetpub/wwwroot/seed/test/unit/servicesSpec.js
Chrome 30.0.1599 (Windows 7) controllers should FAILED
        Error: [ng:areq] Argument 'testcont' is not a function, got undefined
        http://errors.angularjs.org/1.2.0-rc.3/ng/areq?p0=testcont&p1=not%20a%20function%2C%20got%20undefined
            at C:/inetpub/wwwroot/seed/app/lib/angular/angular.js:78:12
            at assertArg (C:/inetpub/wwwroot/seed/app/lib/angular/angular.js:1246:11)
            at assertArgFn (C:/inetpub/wwwroot/seed/app/lib/angular/angular.js:1256:3)
            at C:/inetpub/wwwroot/seed/app/lib/angular/angular.js:5899:9
            at null.<anonymous> (C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js:14:5)
            at Object.invoke (C:/inetpub/wwwroot/seed/app/lib/angular/angular.js:3374:28)
            at workFn (C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js:2082:20)
        Error: Declaration Location
            at window.inject.angular.mock.inject (C:/inetpub/wwwroot/seed/test/lib/angular/angular-mocks.js:2068:25)
            at null.<anonymous> (C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js:12:16)
            at C:/inetpub/wwwroot/seed/test/unit/controllersSpec.js:5:1
Chrome 30.0.1599 (Windows 7): Executed 1 of 1 (1 FAILED) ERROR (0.26 secs / 0.028 secs)

Source: (StackOverflow)