Comments (4)
This usually means you've got the Materialize import coming in the wrong order (after the actual code using it loads). What module loader are you using? If you share your codebase maybe I could see where the loading order goes wrong.
from angular2-materialize.
Hi,
using systemjs: https://github.com/danielschmitz/school-client/blob/master/public/systemjs.config.js
How to install & run my project:
$ npm i -g gulp
$ npm i -g live-server
$ npm i -g typescript
$ npm i -g tsd
$ git clone https://github.com/danielschmitz/school-client.git
$ cd school-client
$ npm install
$ gulp
$ gulp run
click in the TRY TOAST button. Tks
from angular2-materialize.
Try updating your systemjs config to this:
var map = {
'app': 'dist/app',
'@angular': 'dist/@angular',
'angular2-in-memory-web-api': 'dist/angular2-in-memory-web-api',
'rxjs': 'dist/rxjs',
'materialize': 'dist/materialize',
'angular2-materialize': 'dist/angular2-materialize'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'angular2-materialize': {
'main': 'dist/index',
'defaultExtension': 'js'
},
'materialize': {
"format": "global",
'main': 'js/materialize',
'defaultExtension': 'js'
}
};
Also, you'll need to deploy angular2-materialize to your dist folder. I've updated your gulp to this:
var gulp = require('gulp');
var clean = require('gulp-clean');
var shell = require('gulp-shell');
var runSequence = require('run-sequence');
//Diretório com arquivos de distribuição
var dist = 'public/dist';
//Libs que devem ser copiadas para a distribuição
var paths = {
angular: ['node_modules/@angular/**/*.js'],
angularInMemoryWebApi: ['node_modules/rxjs/**/*.js'],
rxjs: ['node_modules/rxjs/**/*.js'],
materialize:['node_modules/materialize-css/dist/**/*'],
'angular2-materialize':['node_modules/angular2-materialize/**/*.js'],
libs: [ 'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/jquery/dist/jquery.min.js'
]
};
//Limpa o diretório de distribuição
gulp.task('clean', function() {
return gulp.src(dist)
.pipe(clean());
});
//Copia as libs
gulp.task('copyMaterialize',function(){
return gulp.src(paths.materialize)
.pipe(gulp.dest(dist+"/materialize"));
});
//Copia as libs
gulp.task('copyAngular2Materialize',function(){
return gulp.src(paths['angular2-materialize'])
.pipe(gulp.dest(dist+"/angular2-materialize"));
});
//Copia as libs
gulp.task('copyLibs',function(){
return gulp.src(paths.libs)
.pipe(gulp.dest(dist));
});
//Copia o Angular 2
gulp.task('copyAngular',function(){
return gulp.src(paths.angular)
.pipe(gulp.dest(dist + "/@angular"));
});
//Copia o AngularInMemoryWebApi
gulp.task('copyAngularInMemoryWebApi',function(){
return gulp.src(paths.angularInMemoryWebApi)
.pipe(gulp.dest(dist + "/angular2-in-memory-web-api"));
});
//Copia o Rxjs
gulp.task('copyRxjs',function(){
return gulp.src(paths.rxjs)
.pipe(gulp.dest(dist+ "/rxjs"));
});
//Executa o compilador tsc
gulp.task('runtsc',shell.task(['tsc']));
//Limpa o diretório typescript compilado
gulp.task('cleantsc', function() {
return gulp.src(dist+"/app")
.pipe(clean());
});
//Tarefa padrão, executada quando rodamos "gulp"
gulp.task('default', function (callback) {
runSequence('clean',
'copyMaterialize',
'copyAngular2Materialize',
'copyLibs',
'copyAngular',
'copyAngularInMemoryWebApi',
'copyRxjs',
'runtsc',function (error) {
if (error) {
console.log(error.message);
} else {
console.log('FINISHED SUCCESSFULLY');
}
callback(error);
});
});
// ['clean','copyMaterialize', 'copyLibs', 'copyAngular', 'copyAngularInMemoryWebApi','copyRxjs','runtsc']);
//Executa o servidor
gulp.task('run',shell.task(['live-server public --no-browser']));
With the above two changes your example works for me.
from angular2-materialize.
Works like a charm!!
My mistake was to join two libs: materialize-css and angular2-materialize
thanks so much !!!!
from angular2-materialize.
Related Issues (20)
- Callback function for onCloseEnd parameter is always being invoked HOT 1
- Project seems unmaintained HOT 3
- unable to use MzToastModule HOT 1
- How do I upgrade this to Angular 6? keep getting type definition error
- checkbox needs doubleclick to uncheck
- Carousel does not load data from service
- Using default html elements HOT 2
- Sidenav did not close
- Checkbox - indeterminate state HOT 1
- Uncaught Error: Template parse errors: Can't bind to 'materializeActions' since it isn't a known property of 'div'. HOT 1
- Uncaught Error: Couldn't find Materialize object on window HOT 13
- Javascript components are unstable
- Select from angular2-material does not work when loading data from an observable
- Datepicker and Select immediately closing on open HOT 21
- How to add carousel-item after http request
- When Router changes the page the materialize module.js stops working
- material_select multiple problem after reset
- want to use in angular 9
- how to use modal that can be reused in other components
- Don't open/show my modal, when I try to open, the modal doesn't show and the button doesn't any action. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-materialize.