10 examples of 'ng add @angular/material' in JavaScript

Every line of 'ng add @angular/material' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
56get hasMaterialDirective() {
57 return this.elementRef.nativeElement.hasAttribute('vclMaterial');
58}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

18function configureMaterial($mdDateLocaleProvider, $mdThemingProvider, $mdIconProvider){
19 $mdThemingProvider.definePalette('black', {
20 '50': '000000',
21 '100': 'ff4081', //promise bar - pink
22 '200': '000000',
23 '300': '000000', //chip
24 '400': '000000',
25 '500': '000000',//header + promise bar - black (has to be)
26 '600': 'ff4081', //selection animation color
27 '700': '000000',
28 '800': '000000', //text
29 '900': '000000',
30 'A100': '000000',
31 'A200': '000000',
32 'A400': '000000',
33 'A700': '000000',
34 'contrastDefaultColor': 'light'
35 });
36
37 $mdThemingProvider.definePalette('white', {
38 '50': 'ffffff', //background color
39 '100': 'ffffff',
40 '200': 'ffffff', //select highlight
41 '300': 'rgb(103,103,103)', //chip
42 '400': 'ffffff',
43 '500': 'ffffff',
44 '600': 'ffffff',
45 '700': 'ffffff',
46 '800': 'ffffff', //text
47 '900': '000000', //select text
48 'A100': 'ffffff', //card background
49 'A200': 'ffffff',
50 'A400': 'ffffff',
51 'A700': 'ffffff',
52 'contrastDefaultColor': 'dark'
53 });
54
55 $mdThemingProvider.theme('default')
56 .primaryPalette('black')
57 .accentPalette('pink')
58 .backgroundPalette('white');
59
60 $mdDateLocaleProvider.parseDate = (dateString) => moment(dateString).toDate();
61
62}
13ngAfterViewInit() {
14 if (typeof componentHandler !== "undefined") {
15 componentHandler.upgradeDom();
16 }
17}
64static addValidMaterialPropTypes(materialPropTypes) {
65 for (var key in materialPropTypes) {
66 allMaterialTypes[key] = materialPropTypes[key];
67 }
68}
55constructor(
56 @Optional() @Inject(MATERIAL_SANITY_CHECKS) private _sanityChecksEnabled: boolean,
57 @Optional() @Inject(HAMMER_LOADER) private _hammerLoader?: HammerLoader) {
58
59 if (this._areChecksEnabled() && !this._hasDoneGlobalChecks) {
60 this._checkDoctypeIsDefined();
61 this._checkThemeIsPresent();
62 this._checkCdkVersionMatch();
63 this._hasDoneGlobalChecks = true;
64 }
65}
19constructor(
20 @Optional()
21 @SkipSelf()
22 private config: FormControlGroupMaterialConfig,
23 private elementRef: ElementRef<HTMLElement>,
24 private renderer: Renderer2,
25 private cdRef: ChangeDetectorRef
26) {
27 if (config) {
28 this.globalMode = config.mode;
29 config.modeChange.subscribe(m => {
30 this.globalMode = m;
31 this.cdRef.markForCheck();
32 });
33 }
34}
17function MaterialComponentsSnippets() {
18 'use strict';
19
20 this.snippetButtons = document.querySelectorAll(
21 '.snippet-caption .copy-to-clipboard-button');
22 this.init();
23}
26function MaterialComponent(options) {
27 BaseComponent.call(this, options);
28 this.selected = null;
29}
104static setLocale(locale: string): ModuleWithProviders {
105 return {
106 ngModule: NgxMaterialTimepickerModule,
107 providers: [
108 {provide: TIME_LOCALE, useValue: locale}
109 ]
110 };
111}
46protected materialDom(props) {
47 let className;
48 if (props.z) {
49 className = 'mdc-elevation--z' + props.z;
50 }
51 return (
52 <p className={className} {...props} ref={this.setControlRef}>
53 {props.children}
54 </p>
55 );
56}

Related snippets