Find a post...

DNN-Connect Blogs

Stop using $scope - learn AngularJS Best Practices an DNN-Connect

There are many bad code-samples showing you how to use AngularJS - and following these will make work with AngularJS confusing and difficult. A typical mistake is to use $scope in your code - something that was a good idea 3 years ago but not any more. Let me tell you more...

We all start with other peoples samples...

I started coding AngularJS based on samples out in the internet - and most people start this way. It's a very difficult way, because almost all samples are so trivial that they don't cover normal use cases - and building an application on that leads to chaos. I basically had to re-learn AngularJS a few times - but then found out that "It would be very simple, if you start the right way".

So at DNN-Connect in Millau I'll teach you how to build simple and complex AngularJS Apps - and why it's very easy to do - even for beginners - if you follow best practices.

Common mistakes I'll help you avoid are

  1. Creating complex code for simple solutions
  2. Using $scope in your code or even worse $apply
  3. Building very simple, or very complex folder structures
  4. Using the DNN ServiceFramework from within your Controllers (yes, you should really not do that)
  5. Using the DNN ServiceFramework from within your Services (yes, this too is not really a good idea)
  6. Not leveraging Dependency-Injection
  7. Assuming that you have a SPA (single page application) when DNN actually allows many modules on a page
  8. ...and much more

Join the Session on Saturday

We learned this and much more the hard way, you can have it all for free in 40 minutes on Saturday at the DNN-Connect in Millau. See you there!

With love from Switzerland,


Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 600 DNN projects since 1999. He is also chief architect of 2sxc (2SexyContent - see forge), an open source module for creating attractive content and DNN Apps.

Daniel Mettler learned programming with the bible translation computer of his parents, deep in the jungles of Indonesia. Since he was only 12 years old at that time and the BIOS only had a version of BASICA, that's what got him started. With 16 he went back to Switzerland and learned German and basic city-survival skills. Equipped with this know-how he founded 2sic internet solutions in 1999 which was focused on web solutions on the Microsoft platform. After a few self-developed CMSs 2sic switched to DNN in 2003 and has been one of the largest partners (17 employees, 700+ projects) in Europe. Daniel is also the chief architect behind the open source 2sxc, a strong promoter of standardization (boostrap, patterns, AngularJS, checklists, etc.) and loves to eat anything - dead or alive. His motto: if the natives eat it, it game.

Hosting liberally provided by

Philipp Becker 6017 7
Geoff Barlow 549 4
DNN-Connect 431 6
Peter Donker 5082 30
Christopher Hammond 685 2
Olivier Jooris 420 1
Daniel Mettler 12038 88
Clint Patterson 1 1
Jos Richters 65 1
James Rosewell 327 2
Will Strohl 1547 27
Ernst Peter Tamminga 438 4
Barry Waluszko 2833 2
Declan Ward 489 1
Gifford Watkins 724 9
Torsten Weggen 2745 3