Yes that is a good approach !
On Sunday, April 21, 2013 10:12:54 PM UTC-6, Ritchie Anesco wrote:
>
> Hi guys,
>
> I'm fairly new to AngularJS, however read tonnes about it and done heaps
> of tutorials and really digging the framework. Anyways, the site I am
> currently building will be using angular across multiple pages, alot of it
> is just search/filtering data. We have multiple apps across different
> pages, and using a script loader (Modernizr) to load apps based on the #ID.
> I am now optimising and DRYing up the script and finding a lot of duplicate
> component directives and filters. We would like to share these modules
> across multiple apps. We were considering creating some sort of 'base line'
> module that will contain these reusable modules and then inject those into
> those 'specific' apps, like so:
>
> //base app used to contain all reusable components
> var baseApp = angular.module('baseApp', [])
> baseApp.filter('truncate', function() {
> });
>
> //apps for different pages - the filter function should be available in
> this app
> var myApp1 = angular.module('myApp1', ['baseApp']);
>
> I'm not sure if this is the best method but any advice/suggestions I'd
> gladly appreciate.
>
> cheers,
> Ritchie
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.