Angular 1.6.5 Template

by KirillMetrik

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.js"></script>
<script src="https://code.angularjs.org/1.6.5/angular-animate.js"></script>
<div ng-app="testApp" ng-controller="testController as $ctrl">
    <div ng-repeat="item in $ctrl.items">
        {{$ctrl.greeting}} {{item}}
    </div>
</div>

JavaScript

var app = angular.module('testApp', []);

app.component('testComponent', {
    bindings: {
        value: '<'
    },
    controller: ['$timeout', function($timeout) {
        var $ctrl = this;

        $ctrl.$onInit = function() {
        };
    }],
    template: 'test-component: {{$ctrl.value}}'
});

app.filter('testFilter', [function() {
    return function(v) {
        return v.toUpperCase();
    };
}]);

app.service('TestService', ['$timeout', function($timeout) {
    this.testMethod = function() {
        return 'service value';
    };
}]);

app.controller('testController', ['$scope', '$http', '$timeout', 'TestService', function($scope, $http, $timeout, TestService) {
    var $ctrl = this;

		$ctrl.greeting = "hi!";
		$ctrl.items=[1,2,3,4,5,6];
}]);