AngularJS with RequireJS best practices

8,326 views
Skip to first unread message

Murali

unread,
May 13, 2012, 8:34:15 PM5/13/12
to AngularJS
Hi

I am planning to use AngularJS on a modarate size(around 15 different
screens). I have had a look at the project
https://github.com/elsom25/angular-requirejs-html5boilerplate-seed as
a starting point. But that does not work with latest AngularJS and
does not look like it follows the best practices.

I am able to bootstrap AngularJS but Still not able to use the
controller properly. Can somebody please guide on the best practices
on how to integrate AngularJS and RequireJS

Thanks,
Murali

mmr...@gmail.com

unread,
May 14, 2012, 9:33:52 AM5/14/12
to ang...@googlegroups.com
OK, I am able to make it work. For anybody looking for a RequireJS and AngularJS integration can refer https://github.com/mmrath/angular-seed 

NOTE: Not sure which one of these(probably controller) should not be be singleton. Don't know if they follow the angular guidelines/best practices

Andy Joslin

unread,
May 14, 2012, 11:46:32 AM5/14/12
to ang...@googlegroups.com
You can define controllers as part of modules to make them visible for angular, will help requireJS a lot.

Eg:
angular.module('myModule.controllers')
    .controller('MyCtrl1'function($scope{
    })
    .controller('MyCtrl2'function($scope{
    })

Murali

unread,
May 14, 2012, 10:32:22 PM5/14/12
to AngularJS
An how do I use it? Tried but could not get it working.

Cary

unread,
May 16, 2012, 8:51:18 AM5/16/12
to ang...@googlegroups.com
Murali,

I've been playing around with AngularJS and put together a RequireJS implementation here https://github.com/CaryLandholt/AngularFun.

Thanks,
Cary

Murali

unread,
May 17, 2012, 9:18:18 AM5/17/12
to AngularJS
nice implementation. thanks

On May 16, 10:51 pm, Cary <c...@landholt.com> wrote:
> Murali,
>
> I've been playing around with AngularJS and put together a RequireJS
> implementation herehttps://github.com/CaryLandholt/AngularFun.

Thomas Thiery

unread,
May 27, 2013, 11:19:11 AM5/27/13
to ang...@googlegroups.com, mmr...@gmail.com
Hi,

I made a simple implementation Server Side to use RequireJS and AngularJS. It's pretty the same implementation than Cary Landholt  but on server side.

If it helps you. 

Mohammad Islam

unread,
Aug 22, 2013, 10:44:30 PM8/22/13
to ang...@googlegroups.com, mmr...@gmail.com
Hi Murali,

I also saw elsom25's seed. Didn't seem very exciting to me either. Have you looked at this angularjs seed that I wrote? After comparing a few good angular seed, I wrote this one. It has a pretty good directory structure and asynchronous loading fashion on-demand. Meaning, you don't have to load tons of the controllers when page loads. With this angular requirejs seed you can load components on demand, when and where it's needed on the fly.
Reply all
Reply to author
Forward
0 new messages