4 ms·
Could you explain a bit more about the tooltip issue you've mentioned? I'd be interested to explore to understand what the limitation is and how I (or others) m
by aidos 13y ago
Could you explain a bit more about the tooltip issue you've mentioned? I'd be interested to explore to understand what the limitation is and how I (or others) might approach it.
I'm not sure I agree with all of your comments.
I find that services are relatively essential building blocks for my applications.
Providers are there so that you can preconfigure your modules. It's a legitimate use case. Take Restangular, for example - it's so useful to you because it's a provider that you can configure for your app.
I can see how $rootScope could be perceived as code smell but after examining how angular uses it internally I'm ok with the way I use it.
Directives are confusing the first time you see them. You need to see a few examples. Though I don't think there's a problem with the api for declaring them. There's a lot to configure - it's mostly optional, but you may well need all of it eventually.
Angular gives you a framework to build on. You can create really amazing components that are totally reusable on your other projects. Sometimes they come in the form of directives, sometimes they're other types of module. Often when you start abstracting that out you'll need to get a bit closer to the metal. Angular provides an api for you to work with in those cases and it's ok to take advantage of that.
- mackwic 13y ago> Could you explain a bit more about the tooltip issue you've mentioned? Say that you have a dynamically generated form where an input should display a tooltip only in specific cases. Using tooltip="" will not do the trick, you have to do some sorcery to attach dynamically your tooltip, aKa: using compiler in your controller to replace dynamically the DOM region with the DOM elements returned by $compile and jQuery. > I find that services are relatively essential building blocks for my applications. But they doesn't help much against the issue of feature scaling. Some UI logic just can't be factorized. Some other data handling is to specific to be re-used elsewhere. In a large business application, logic is poor but corner cases are legion. We made the choice to keep our specific logic near the place they are used against using services because that doesn't add any value. > Providers are there so that you can preconfigure your modules Again, thats what the rest of the world call 'a factory'. You can perfectly imagine a Factory that register in $injector it's instances. IY think Provider should stay something internal and not be documented as a feature everyone can use. It's not. > I can see how $rootScope could be perceived as code smell but after examining how angular uses it internally I'm ok with the way I use it. I am too. But I don't want anyone else than hackers to use it. > Directives are confusing the first time you see them. They are confusing because everything is blend together. Separate the different use cases and everything will be simpler. Even if it's the same internal thing (that you can use directly if you need). My point is that if you provide different handlers, noone will ever fear the directives. > You can create really amazing components that are totally reusable on your other projects. If only... In the real world, there is no way my current employer will accept I'll reuse his code for my next project. Only FLOSS libraries can do that.