Skip to content

Commit 2f7be3f

Browse files
committed
Added index to be required as module
1 parent a3f3728 commit 2f7be3f

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

README.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,37 @@ angular-materialize
33

44
**angular-materialize** in action http://krescruz.github.io/angular-materialize/
55

6-
This library is a set of AngularJS directives which make it possible to use features from [Materialize](http://materializecss.com/) with AngularJS.
6+
This library is a set of AngularJS directives which make it possible to use features from [Materialize](http://materializecss.com/) with AngularJS.
77

8-
Just add the module ui.materialize to your dependencies like:
8+
Just add the module ui.materialize to your dependencies like:
99

1010
angular.module('angular-app', [
1111
'ui.materialize'
1212
])
13-
14-
and then you are good to go.
15-
16-
This is not to be confused with the [Angular Material](https://material.angularjs.org/) project, which is a standalone Material design implementation for AngularJS.
17-
18-
We are on Bower, look for [`angular-materialize`](http://bower.io/search/?q=angular-materialize).
19-
2013

14+
and then you are good to go.
15+
16+
This is not to be confused with the [Angular Material](https://material.angularjs.org/) project, which is a standalone Material design implementation for AngularJS.
17+
18+
We are on Bower, look for [`angular-materialize`](http://bower.io/search/?q=angular-materialize).
19+
or in NPM, look for [`angular-materialize`](https://www.npmjs.com/package/angular-materialize).
20+
21+
##### Use with Webpack
22+
Angular looks for jQuery and if no exists, it uses jQlite. Some directives of `angular-materialize` uses some jQuery methods, so be sure that Angular uses it instead of jQlite. It can be done by adding the following lines in your config.
23+
```javascript
24+
//webpack.config.js
25+
plugins: [
26+
new webpack.ProvidePlugin({
27+
'window.jQuery': 'jquery'
28+
})
29+
],
30+
```
31+
then simply add to your module:
32+
```javascript
33+
// yourModule.js
34+
// ES6 style
35+
import angularMaterialize from 'angular-materialize';
36+
// OR commonjs style
37+
var angularMaterialize = require('angular-materialize');
38+
angular.module('yourModule', [angularMaterialize]);
39+
```

src/index.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
var fs = require('fs');
2-
var vm = require('vm');
3-
4-
module.exports.bind = function (angular, jquery) {
5-
var context = {'angular': angular, '$': jquery};
6-
var src = fs.readFileSync(__dirname + '/angular-materialize.js', 'utf8');
7-
vm.runInNewContext(src, context);
8-
return context;
9-
};
1+
require('./angular-materialize');
2+
module.exports = 'ui.materialize';

0 commit comments

Comments
 (0)