Both versions should work if you set-up your application correctly.
Option 1 uses strict dependency injection, which is why you pass the names of the objects that will be injected into your controller.
Strict DI will allow for code minification, and you can name the arguments you pass the controller's function whatever you want (see example).
You will have to declare strict Dependency Injection in the bootstrap call by passing an optional object:
angular.bootstrap(window.document, ['appModule'], {
strictDi: true
});
Option 2 does not use strict DI (default behaviour): the names injected as arguments must reflect the names used by the framework.
Option 1 - Strict dependency injection
var app = angular.module('appModule', []);
// Option 1 - Strict dependency injection
app.controller('MyController', ['$scope', function(myScope) {
this.greeting = 'Hello World!';
myScope.test = 'A scope property';
}]);
angular.bootstrap(window.document, ['appModule'], {
strictDi: true
}); // Bootstrap the AngularJS app with strict dependency injection
<h2>Strict dependency injection</h2>
<div ng-controller="MyController as myCtrl">
<p>{{ myCtrl.greeting }}</p>
<p>{{ test }}</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
Option 2 - Non-strict dependency injection
var app = angular.module('appModule', []);
// Option 2 - non strict dependency injection
app.controller('MyController', function($scope) {
this.greeting = 'Hello World!';
$scope.test = 'A scope property';
});
angular.bootstrap(window.document, ['appModule']);
<h2>Non-strict dependency injection</h2>
<div ng-controller="MyController as myCtrl">
<p>{{ myCtrl.greeting }}</p>
<p>{{ test }}</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>