Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Can't use piecemeal #1341

Closed
paynecodes opened this issue Jan 30, 2015 · 8 comments
Closed

Can't use piecemeal #1341

paynecodes opened this issue Jan 30, 2015 · 8 comments

Comments

@paynecodes
Copy link
Contributor

I'm upgrading from v0.5.1, and trying to use this framework piecemeal. Our application uses strict mode DI. Because the angular material framework doesn't use strict mode, Angular is throwing errors. Any ideas what can be done other than using the packaged version?

@ilanbiala
Copy link
Contributor

I also ran into this issue with ngMaterial, had to stop using strict mode DI.

@epelc
Copy link
Contributor

epelc commented Jan 30, 2015

Add ng-annotate to your build process?

@paynecodes
Copy link
Contributor Author

@epelc Our team made the decision to explicitly declare our dependencies like this before I came on board. I'm certainly not opposed to ng-annotate, but, for this project, it can't happen. I created this issue in hopes that the material team will see the value in supporting those that use Strict DI without a build step for adding DI annotations.

angular.module('myModule', ['someThing'])
  .controller('someController', ['someOtherThing', someController);

function someController(someOtherThing) {
   // ...
}

Thank you for your suggestion :)

@ThomasBurleson
Copy link
Contributor

@jpdesigndev - Using ng-annotate in the build process will build and deploy the angular-material.js (concatenated source) with the correct .$inject usages; e.g.

MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"];

If you are using AngularJS Strict DI mode, this should not be a problem when using the build angular-material.js file. Or am I misunderstanding something ?

@epelc
Copy link
Contributor

epelc commented Feb 2, 2015

You can still use ng annotate even if half of your app declares the injections. I really don't see why you wouldn't want to use it. It saves a ton of time and reduces duplicate code. But it may be good to make angular material work wit hout it.

@paynecodes
Copy link
Contributor Author

@ThomasBurleson @epelc Sorry, it seems I wasn't getting notifications about these responses.

@ThomasBurleson Perhaps, the thing your missing about my question is that I was looking to use angular-material pieces individually without including the entire framework as a single .js file. And, since our team hasn't introduced a "build on every save" step, and we're using Strict DI even when developing, it's virtually impossible.

I agree that ng-annotate is a bit of a no brainer. And, I admit that, for my side project, I WILL NOT have these kinds of restrictions. But, as much as I like ng-annotate, building on the fly, etc, my entire team doesn't feel the same. So, in lieu of ng-annotate, my question is about using the pieces of angular material without getting the entire framework. I suppose it's a bit of a difficult ask. Let me see what else I can do on my end. Perhaps, something like will require a custom build of sorts on our own branch.

@ThomasBurleson
Copy link
Contributor

@jpdesigndev - you can build the individual components yourself if you clone the repository and run

npm update;
gulp build
# build the mdIcon component, demos, and files - see /dist/demos/icon for build assets
gulp build-demo -c icon  

We also auto-build each module individually for you. See the components in Bower Material Modules

@paynecodes
Copy link
Contributor Author

Woah! That's cool. Thank you @ThomasBurleson

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants