"deleteTeam"ボタンをクリックすると、成功メッセージを追加しようとしました/ポップアップを画面に表示しています。 2角度に新しい、これを行う方法上の任意のアイデアは素晴らしい感謝:)ブートストラップ成功メッセージ - 角度2
myteams.component.html
<div class="mdl-grid titleStyle">
<div class="mdl-cell mdl-cell--12-col">My Teams</div>
</div>
<div class="container-fluid page-cont">
<div class="container">
<div class="row">
<div class="col-md-12" style="margin-bottom:30px;">
<ul class="progressbar">
<li>Create a Team</li>
<li class="active">My Teams</li>
<li>Load Board</li>
<li>Play</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div *ngIf = "myTeams.length < 1" class="alert alert-warning alert-no-teams">
<h4 class ="noTeams">You haven't created any teams. Click Create a Team to get started. <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored btnWidth" routerLink="/create-team">Create a Team</button></h4>
</div>
</div>
</div>
</div>
<section>
<div class="mdl-card mdl-shadow--2dp teams-container-card" style="width:100%; padding-top:30px; padding-left:30px; padding-right:30px; background-color:#efefef;" *ngIf = "myTeams.length > 0">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class=" mdl-card-team demo-card-wide mdl-card mdl-shadow--2dp col-md-12" *ngFor = "let team of myTeams" style="width: 100%;">
<div class="row">
<div class="col-md-2 col-sm-12 text-center">
<img src="images/logo.png" class="img-circle nimbleIcon">
</div>
<div class="col-md-8 col-sm-12 myTeamsCont" style="padding-top:40px; padding-bottom:25px; padding-left: 30px;">
{{team.name}}
</div>
<div class="col-md-2 col-sm-12">
<div class="button-load" routerLink="/dashboard">Load</div>
<div class="button-remove" (click) = "deleteTeam(team)" ngIf="deleteSucess">Remove</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
app.comonent.ts
import { OnInit, Component } from '@angular/core';
@Component({
selector: 'myteams-component',
templateUrl: 'myteams.component.html',
styleUrls: [ 'myteams.component.css' , 'progress.css' ]
})
export class MyTeamsComponent {
title = "My Teams";
myTeams = [ ];
ngOnInit() {
this.loadTeams();
}
loadTeams() {
var myTeams = new Array();
var i =0;
if(localStorage.getItem("storedTeams")){
this.myTeams = JSON.parse(localStorage.getItem("storedTeams"));
}
}
deleteTeam(team){
var teams = this.myTeams;
var length = teams.length;
var i;
var indexObj;
var index;
for(i = 0; i < length; i ++){
if(team.name===teams[i].name){
console.log(team.name);
indexObj = teams[i];
index = teams.indexOf(indexObj);
teams.splice(index, 1);
localStorage.setItem("storedTeams", JSON.stringify(teams));
}
}
}
だろう
}
をrefferしてください? deleteTeam(team)は呼び出されませんか? –
が呼び出されると、呼び出された後に成功ボックスを追加する方法を知りたいと思います。 –
なぜアラート(「成功」)を使用しないのですか。 ? –