File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
app-src/scripts/task-list Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change 166166 }
167167
168168 // show toast for undo
169- let toast = this . $mdToast . simple ( )
170- . textContent ( 'You deleted "' + task . title + '"' )
171- . action ( 'UNDO' )
172- . hideDelay ( 15000 )
173- . position ( 'bottom' ) ;
174-
175- this . $mdToast . show ( toast )
169+ this . $mdToast . show ( {
170+ hideDelay : 20000 ,
171+ controller :
172+ /* @ngInject */
173+ ( $scope , $mdToast ) => {
174+ $scope . undo = ( ) => {
175+ $mdToast . hide ( 'UNDO' ) ;
176+ } ;
177+ } ,
178+ template : `
179+ <md-toast>
180+ <div class="md-toast-text" flex>
181+ <ng-md-icon icon="delete_forever"
182+ style="fill:#e11826"></ng-md-icon>
183+ You deleted "${ task . title } "
184+ <md-button class=""
185+ ng-click="undo()">
186+ <ng-md-icon icon="undo"></ng-md-icon>
187+ UNDO</md-button>
188+ </div>
189+ </md-toast>`
190+ } )
176191 . then ( function ( response ) {
177- if ( response === 'ok ' ) {
192+ if ( response === 'UNDO ' ) {
178193 // re-add task on undo
179194 that . tasks . splice ( $index , 0 , taskCopy ) ;
180195 }
You can’t perform that action at this time.
0 commit comments