Skip to content

Commit 79d6702

Browse files
committed
Small refactoring + comment
1 parent 2929cf5 commit 79d6702

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/angular/app/common/chips/chips.component.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,17 @@ export class ChipsComponent extends BaseComponent implements AfterViewInit {
4545
let autocompleteData = {};
4646
this.availableTags.filter((tag) => this.excludedTags.indexOf(tag) == -1 ).
4747
forEach((tag) => autocompleteData[tag] = null);
48-
const chips = $('.chips');
49-
for (let i = 0; i < chips.length; i++){
50-
M.Chips.init(chips[i], {
51-
autocompleteOptions: {
52-
data: autocompleteData,
53-
limit: Infinity,
54-
minLength: 1
55-
},
56-
placeholder: this.placeholder,
57-
secondaryPlaceholder: this.placeholder
58-
});
59-
}/*
60-
chips.chips({
48+
49+
const chips = document.querySelectorAll('.chips');
50+
M.Chips.init(chips, {
6151
autocompleteOptions: {
6252
data: autocompleteData,
6353
limit: Infinity,
6454
minLength: 1
6555
},
6656
placeholder: this.placeholder,
6757
secondaryPlaceholder: this.placeholder
68-
});*/
69-
58+
});
7059
}
7160

7261
add(chip) {

src/angular/vendor.aot.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ import 'chartjs-plugin-annotation';
1515
// Other vendors for example jQuery, Lodash or Bootstrap
1616
// You can import js, ts, css, sass, ...
1717

18-
window['Materialize'] = M;
18+
// angular2-materialize is still on materialize-css v0.100.1 and requires global variable called 'Materialize'
19+
// while this app is now on materialize-css v1.0.0 which renamed the variable from 'Materialize' to 'M'.
20+
// The fix below makes angular2-materialize work with materialize-css v1.0.0
21+
window['Materialize'] = M;

0 commit comments

Comments
 (0)