Starting my project with Angular version 1.5 and above.
Below is the code for my controller:
'use strict';
(function(){
class FlamingoController {
constructor($http) {
this.$http = $http;
this.flamingo = [];
}
$onInit() {
this.$http.get('/api/flamingo')
.then(response => {
this.flamingo = response.data;
})
}
}
angular.module('wildroseApp')
.component('flamingo', {
templateUrl: 'app/flamingo/flamingo.html',
controller: FlamingoController,
});
})();
When I attempt to add my controller in the view like this:
<div class="container" ng-controller="FlamingoController as ctrl">
I encounter the following error:
Error: [ng:areq] Argument 'FlamingoController' is not a function, got undefined