Imagine a traditional service injection in an angular applicationJS
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script><body><divng-app="meuApp" ng-controller="meuCrontrole">
<p>Dados providos do service "meuControle"</p>
<h1>{{recebeDados}}</h1>
<h1>{{dados}}</h1>
</div>
<script>
var app = angular.module('meuApp', []);
app.service('meuServico1', function() {
this.myFunc = function (x) {
return x.toString(16);
}
});
app.controller('meuCrontrole', function($scope, meuServico1) {
$scope.recebeDados = meuServico1.myFunc(22);
});
</script>
</body>
</html>
However, I came across a project in IONIC with the following controller syntax:
(function () {
angular.module('projeto.projeto', [])
.controller('Template1Ctrl', function ($scope, $parametros) {
$scope.dados = "Dados entregue";
});
})();
And I have to inject a service inside the controller with the following syntax:
(function () {
angular.module('projeto.projeto')
.service('Template1Service', function ($parametros) {
//conteudo
}
});
})();
I tried to inject the service between keys, as a function, as a parameter, but always breaks the application. If possible, I would like to know if there are any differences between using the angle bundle within Ionic and the traditional angular.min.js file. The passing impression is that there are differences between purely developing in the angular, or angular / ionic. Or I just came across a different syntax to express the controller.
I created a gist with error message and the codes summarized: link
All full code tracking is available at link