Git Product home page Git Product logo

ng2-bootstrap-929's Introduction

ng2-bootstrap Bug Reproduction

Issue: valor-software/ngx-bootstrap#929

Steps

New angular cli project

Create new project using Angular CLI master branch, since npm @latest doesn't support RC.6 yet. 7150cf9cac6b0bb7daea8a709c473b37498906af

>ng -v
angular-cli: local (v1.0.0-beta.11-webpack.8, branch: master)
node: 6.5.0
os: win32 x64

>ng new ng2-bootstrap-929
...

>cd ng2-bootstrap-929

>npm link angular-cli
...

# ng serve works
# ng test works

ng2-bootstrap installation

>npm install ng2-bootstrap --save
... # few UNMET PEER DEPENDENCY warnings 

AlertModule works

/* src/app/app.module.ts */
...
import { AlertModule } from 'ng2-bootstrap';

...
@NgModule({
  imports: [
    ...
    AlertModule,
  ],
  ...
})
export class AppModule {}
<!-- src/app/app.component.html -->
<alert type="info">Hello from ng2-bootstrap</alert>


<!-- src/index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

ng serve works, expected output in http://localhost:4200/ ng test works after adding the import in the test module:

/* src/app/app.component.spec.ts */
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';

describe('App: Ng2Bootstrap929', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        AppModule
      ],
    });
  });

  ...

DatePicker Module works in browser, but fails tests

/* src/app/app.module.ts */
...
import { AlertModule, DatepickerModule } from 'ng2-bootstrap';

...
@NgModule({
  imports: [
    ...
    AlertModule,
    DatepickerModule
  ],
  ...
})
export class AppModule {}

Already ng test will fail with the No provider for NgModel error but let's add it in the template to see if it works:

<!-- src/app/app.component.html -->
<div style="display:inline-block; min-height:290px;">
  <datepicker [(ngModel)]="date" showWeeks="true"></datepicker>
</div>
/* src/app/app.component.ts */

...
export class AppComponent {
  title = 'app works!';
  date = new Date();
}

Go to http://localhost:4200/ - works fine!

Full error

>ng test
12 09 2016 20:35:00.541:WARN [karma]: No captured browser, open http://localhost:9876/
12 09 2016 20:35:00.547:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
12 09 2016 20:35:00.548:INFO [launcher]: Launching browser Chrome with unlimited concurrency
12 09 2016 20:35:00.703:INFO [launcher]: Starting browser Chrome
12 09 2016 20:35:02.243:INFO [Chrome 53.0.2785 (Windows 10 0.0.0)]: Connected on socket /#iCWSJsVtd9on-TitAAAA with id 44918316
Chrome 53.0.2785 (Windows 10 0.0.0) App: Ng2Bootstrap929 should create the app FAILED
        No provider for NgModel ("[ERROR ->]<datepicker ngModel></datepicker>"): DatePickerComponent_Host@0:0
        Error: Template parse errors:
            at TemplateParser.parse (http://localhost:9876/_karma_webpack_/0.bundle.js:6243:19)
            at RuntimeCompiler._compileTemplate (http://localhost:9876/_karma_webpack_/0.bundle.js:13822:51)
            at http://localhost:9876/_karma_webpack_/0.bundle.js:13683:59
            at Set.forEach (native)
            at compile (http://localhost:9876/_karma_webpack_/0.bundle.js:13683:23)
            at RuntimeCompiler._compileModuleAndAllComponents (http://localhost:9876/_karma_webpack_/0.bundle.js:13686:52)
            at RuntimeCompiler.compileModuleAndAllComponentsSync (http://localhost:9876/_karma_webpack_/0.bundle.js:13652:21)
            at TestingCompilerImpl.compileModuleAndAllComponentsSync (http://localhost:9876/_karma_webpack_/0.bundle.js:17452:35)
            at TestBed._initIfNeeded (webpack:///C:/Users/Igonato/Projects/nglab/ng2-bootstrap-929/~/@angular/core/bundles/core-testing.umd.js:1059:0 <- src/test.ts:17854:40)
            at TestBed.createComponent (webpack:///C:/Users/Igonato/Projects/nglab/ng2-bootstrap-929/~/@angular/core/bundles/core-testing.umd.js:1141:0 <- src/test.ts:17936:18)
Chrome 53.0.2785 (Windows 10 0.0.0): Executed 1 of 3 (1 FAILED) (0 secs / 0.216 secs)
...
Chrome 53.0.2785 (Windows 10 0.0.0): Executed 3 of 3 (3 FAILED) ERROR (0.56 secs / 0.411 secs)

ng2-bootstrap-929's People

Contributors

igonato avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.