Thursday, December 11, 2014

notes to take care when developing with AngularJS

1. in 1.3.X you cant use anonymous CTRLs, so this:
<div ng-app="">
   <div ng-controller="FisrtCtrl" >
        .......content......
 
  </div>
</div>

<script>function FisrtCtrl($scope){.........};</script>
will not work anymore, you must use

you will get this error "'argument 'FirstCtrl' is not a function, got undefined'".
the simple sln is:
<div ng-app="myApp">
<script>
   var myApp = angular.module('myApp');
   myApp.controller('FisrtCtrl', function ($scope){.........});
</script>

2. if by any case u've written a code that fails your services constructors (funtions) will not be called.
be thing to do is to write a super simple CTRL to call a string from it.

3. binding HTML must be done with a filter as shown here
http://creative-punch.net/2014/04/preserve-html-text-output-angularjs/
or some extra JS libraries
http://blog.29steps.co.uk/post/60867715914/dynamically-output-html-within-angularjs

No comments:

Post a Comment