These are chat archives for AngularClass/angular2-webpack-starter

8th
Jun 2017
texirv0203
@texirv0203
Jun 08 2017 02:10
  • I am new to angular, I am trying to display alert when I click each li.
  • but I am getting an error ncaught TypeError: (t.data || "").search is not a function
  • can you guys tell me how to fix it.
  • providng code below
http://plnkr.co/edit/M05wS03ynxX812u2MATc?p=preview&open=app%2Fapp.component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'my-app',

  styles: [`
    li {
      color: red;
    }
  `],
  template: `<ul class= "master">
                <li *ngFor ="let student of liArraycontent" (click) = "liClicked(this)"> {{student}} </li>
              </ul>`
})
export class AppComponent { 
  name = 'Angular';
  liArraycontent = ["testing 1", "testing 2", "testing3"]
  this.liClicked = function(e1) {
      alert('a');
  }


}


/*
Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
Ritwik Banerjee
@ritwbanerjee
Jun 08 2017 02:18
only 1 change -> this.liClicked changes to liClicked
@texirv0203
David Gnanasekaran
@davidsekar
Jun 08 2017 15:02
main.40bf9a1….bundle.js:1 Uncaught Error: A platform with a different configuration has been created. Please destroy it first.
at d (polyfills.f9cf3d6….bundle.js:1)
at lt (main.40bf9a1….bundle.js:1)
at main.40bf9a1….bundle.js:1
at r (main.40bf9a1….bundle.js:1)
at Object.lWp9 (main.40bf9a1….bundle.js:1)
at e (main.40bf9a1….bundle.js:1)
at +27R (main.40bf9a1….bundle.js:1)
at main.40bf9a1….bundle.js:1
running the AOT build results in following error