I'm using the module $mdDialog from Angular Material but I don't need the full library. Is it possible to only include the modules that I need in the project, and how can I do that? I have installed Angular Material with Bower and using Gulp in my project.
相关问题
- angularJS: ui-router equivalent to $location.searc
- Separate AngularJS Controllers Into Separate Files
- Angular ngAnimate not working first time on page l
- Ionic Spinner not showing up
- Angular Mat Select CompareWith ID number, and Emit
相关文章
- Angular Material Stepper causes mat-formfield to v
- Angular material table not showing data
- Passing variable through URL with angular js
- Watch entire object (deep watch) with AngularJS
- Angular ng-if change span text
- Can ng-show directive be used with a delay
- AngularJS $routeParams vs $stateParams
- how can I use babel polyfill to support all IE11 i
You choose only the components you want, by making a custom angularjs build from angular material git repository as follows
For custom js build
In the "\gulp" folder edit the util.js, update the buildJs() function
I am using angularjs with webpack, I copied the "angular-material.js" to "\node_modules\angular-material" in my application and I was able to make a build without any changes.
For building custom css
edit "build-scss.js" in "\gulp\tasks" folder in the repository. edit the getPaths() function
I hope it helps, please comment in case angular material gulp build is changed.
Other way
when you install angularjs with npm, you can find js and css files for each component in "\node_modules\angular-material\modules\js" you can use your custom build to concatinate them.
Soon Angular Material will turn into
v1.1.0
as a major release.As an addition the
material-tools
repository will be announced.Material Tools allows developers to build a custom Angular Material build with the most necessary components.
It also can build precompiled theme stylesheets, which improves the performance significantly.
Material Tools is already available, but still in beta.
As per my comment above,
$mdDialog
depends on angular-material.js, which depends on angular.js, angular-aria.js and angular-animate.js. I don't think there's any way around that.Although you are using Angular Material I would like to suggest an alternative - Polymer, which is similar to and consistent in style with Angular Material. This suggestion is related to you not wanting to load lots of dependencies.
The advantage of using Polymer is that you can include separate elements, for example paper-dialog - demo
From the docs