Giter VIP home page Giter VIP logo

Comments (6)

mistic100 avatar mistic100 commented on June 19, 2024

The point is being able to do

angular.module('myApp', [
  require('angular-placeholder')
]);

from angular-placeholder.

fidian avatar fidian commented on June 19, 2024

Is this a pattern that Angular libraries typically follow? Is there Webpack documentation on this approach?

I ask because I don't use Webpack and this works great with Browserify as-is. Also, if I change the main entry to index.js with the content you suggested, none of the code would be exported.

Wouldn't the exact same effect be accomplished if I had module.exports = "taiPlaceholder"; as the last line in lib/tai-placeholder.js?

from angular-placeholder.

mistic100 avatar mistic100 commented on June 19, 2024

it seems that all angular official modules follow this pattern.

The code actually does not need to be exported, out just needs to be executed to register the module inside angular.

You can indeed make the change in the current main file but don't forget to check that module.exports actually exists (for bower and "old-school" users)

from angular-placeholder.

mistic100 avatar mistic100 commented on June 19, 2024

On the other hand I don't know Browserify will react the the change. But if you already use things like angular-animate or angular-cookies it shouldn't be a problem.

from angular-placeholder.

fidian avatar fidian commented on June 19, 2024

This appears to have no problems whatsoever for me and it helps you out. I've added a test to confirm the functionality and everything appears to be working as expected. I've released 1.1.0 in the hopes that it works for you. Let me know if I didn't do it right.

from angular-placeholder.

mistic100 avatar mistic100 commented on June 19, 2024

Thank you, works perfectly.

from angular-placeholder.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.