Мне сложно определить, в чем проблема.AngularJS: Ardument 'Controller as short' не является функцией, получил undefined
Почему этот код (index.html) запустить
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</head>
<body>
<div class="list-group-item" ng-repeat="product in store.products">
<section ng-controller="TabController as tab">
</section>
</div>
</body>
</html>
в то время как
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</head>
<body>
<section ng-controller="TabController as tab">
</section>
</body>
</html>
выдает ошибку:'Error: Аргумент 'TabController в закладке' не является функцией, был неопределенным в Ошибка (родной) '
app.js:
(function() {
var app = angular.module('gemStore', []);
app.controller('StoreController', function() {
this.products = gems;
});
app.controller("TabController", function() {
this.tab = 1;
this.isSet = function(checkTab) {
return this.tab === checkTab;
};
this.setTab = function(setTab) {
this.tab = setTab;
};
});
var gems = [
{
data : 'data'
}
];
})();
Большое вам спасибо!
Посмотрите на наличие возможностей в вашей версии. – PSL