Three linked problems : Argument 'MainCtrl' is not a function and Module 'myApp' is not available

I got these three problems, which I think are linked. I read a lot of posts, and Google it since 2 days, but because I’m working with the ionic creator, I didn’t find a proper answer…

The curious fact is I can run and use my app except one MainCtrl function, it works, but I still have these errors messages :

Error: [$injector:nomod] Module ‘myApp’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Error: [ng:areq] Argument ‘MainCtrl’ is not a function, got undefined

Error: [ng:areq] Argument ‘LoadingCtrl’ is not a function, got undefined

Here is my code, I’m sure it’s a little mistake but I can’t figure it out :

// Here is the module declaration

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

// The first controller's

myApp.controller('MainCtrl', ['$scope', '$ionicPopup', '$timeout', function($scope, $ionicPopup, $timeout) {
$scope.createPopUpService = function(){

var newTemplate = '<div>Hi</div>';  
var myService = ${
        template: newTemplate,
        title: 'Test',
        scope: $scope,
        cssClass: 'popJoinService',
        buttons: [
              { text: '<b>Cancel<b/>',
                type: 'button-assertive'
                text: '<b>OK</b>',
                type: 'button-positive',
                onTap: function(e) {

// The second controller's

myApp.controller('LoadingCtrl', function($scope, $ionicLoading) {
  $ = function() {
      template: 'Loading...',
      duration: 3000
       console.log("The loading indicator is now displayed");
  $scope.hide = function(){
       console.log("The loading indicator is now hidden");
<ion-view title="HTML1" style="background-color:#93E693;">

    <ion-refresher (ionRefresh)="doRefresh($event)" ng-controller ="LoadingCtrl">
                      pullingText="Pull to refresh"

<!-- I also tried this : ng-app="app.directives" and ng-app="" but it seems the change as no effect on the result-->
<!-- Because it is ionic creator, I can't add scripts like usually -->
  <div ng-controller="MainCtrl">
      <button class="item-avatar button  button-small button-calm  button-block icon-left ion-android-add" ng-click="createPopUpService()">test button</button>

Is someone see something ? Maybe the syntax is not good ?