nire0510
11/11/2014 - 2:44 PM

AngularJS

AngularJS

(function (angular) {
    'use strict';

    angular
        .module('app')
        .service('MyService', MyService);

    MyService.$inject = ['$http'];

    function MyService ($http) {
        this.getData = getData;

        function getData() { }
    }
})(window.angular);
(function (angular) {
    'use strict';

    angular.module('$safeitemname$', [
        // Angular modules 
        'ngAnimate',
        'ngRoute'

        // Custom modules 

        // 3rd Party Modules
        
    ]);
})(window.angular);
(function (angular) {
  'use strict';

  angular
    .module('app')
    .filter('myFilter', myFilter);

  function myFilter () {
    return function(input) {
      return input ? '\u2713' : '\u2718';
    };
  }
})(window.angular);
(function (angular) {
    'use strict';

    angular
        .module('app')
        .factory('myFactory', myFactory);

    myFactory.$inject = ['$http'];

    function myFactory ($http) {
        var service = {
            getData: getData
        };

        return service;

        function getData() { }
    }
})(window.angular);
(function(angular) {
    'use strict';

    angular
        .module('app')
        .directive('myDirective', myDirective);

    myDirective.$inject = ['$window'];
    
    function myDirective ($window) {
        var directive = {
            link: link,
            restrict: 'EA'
        };
        return directive;

        function link(scope, element, attrs) {
        }
    }

})(window.angular);
(function (angular) {
    'use strict';

    angular
        .module('app')
        .controller('MyController', MyController);

    MyController.$inject = ['$location']; 

    function MyController ($location) {
        var vm = this;
        
        vm.title = 'MyController';

        activate();

        function activate() { }
    }
})(window.angular);
(function (angular) {
    'use strict';

    angular
        .module('app')
        .controller('MyController', MyController);

    MyController.$inject = ['$scope']; 

    function MyController ($scope) {
        $scope.title = 'MyController';

        activate();

        function activate() { }
    }
})(window.angular);
(function (angular) {
  'use strict';

  angular
    .module('app')
    .constant('MY_VAL', {
      foo: 'bar'
    });

})(window.angular);