This commit is contained in:
Jon Lambson 2017-10-23 17:26:06 -06:00
parent df43dbe68f
commit ef91990767
8 changed files with 15 additions and 13 deletions

View File

@ -56,8 +56,8 @@
<script src="/js/controllers/website-controller.js" charset="utf-8"></script> <script src="/js/controllers/website-controller.js" charset="utf-8"></script>
<script src="/js/controllers/dns-controller.js" charset="utf-8"></script> <script src="/js/controllers/dns-controller.js" charset="utf-8"></script>
<script src="/js/controllers/email-controller.js" charset="utf-8"></script> <script src="/js/controllers/email-controller.js" charset="utf-8"></script>
<script src="/js/controllers/shows-controller.js" charset="utf-8"></script> <script src="/js/controllers/websites-controller.js" charset="utf-8"></script>
<script src="/js/controllers/showsDetail-controller.js" charset="utf-8"></script> <script src="/js/controllers/websitesDetail-controller.js" charset="utf-8"></script>
<!-- Divrectives --> <!-- Divrectives -->
<script src="/js/directives/achievement-directive.js" charset="utf-8"></script> <script src="/js/directives/achievement-directive.js" charset="utf-8"></script>
<script src="/js/directives/todo-directive.js" charset="utf-8"></script> <script src="/js/directives/todo-directive.js" charset="utf-8"></script>

View File

@ -117,14 +117,14 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: { views: {
'content@': { 'content@': {
templateUrl: 'templates/websites.html', templateUrl: 'templates/websites.html',
controller: 'ShowsController', controller: 'websitesCtrl as vm',
} }
} }
}) })
.state('app.websites.detail', { .state('app.websites.detail', {
url: '/detail/:id', url: '/detail/:id',
templateUrl: 'templates/websites-detail.html', templateUrl: 'templates/websites-detail.html',
controller: 'ShowsDetailController' controller: 'websitesDetailCtrl as vm'
}) })
.state('app.dns', { .state('app.dns', {
url: 'dns', url: 'dns',

View File

@ -1,3 +0,0 @@
app.controller('ShowsController', ['$scope','ShowsService', function($scope, ShowsService) {
$scope.shows = ShowsService.list();
}]);

View File

@ -1,3 +0,0 @@
app.controller('ShowsDetailController', ['$scope','$stateParams', 'ShowsService', function($scope, $stateParams, ShowsService) {
$scope.selectedShow = ShowsService.find($stateParams.id);
}]);

View File

@ -0,0 +1,4 @@
app.controller('websitesCtrl', ['$scope','ShowsService', function($scope, ShowsService) {
var vm = this;
vm.shows = ShowsService.list();
}]);

View File

@ -0,0 +1,4 @@
app.controller('websitesDetailCtrl', ['$scope','$stateParams', 'ShowsService', function($scope, $stateParams, ShowsService) {
var vm = this;
vm.selectedShow = ShowsService.find($stateParams.id);
}]);

View File

@ -1,4 +1,4 @@
<h3>{{ selectedShow.name }}</h3> <h3>{{ vm.selectedShow.name }}</h3>
<p> <p>
{{ selectedShow.description }} {{ vm.selectedShow.description }}
</p> </p>

View File

@ -1,5 +1,5 @@
<ul> <ul>
<li ui-sref-active="selected" ng-repeat="show in shows"> <li ui-sref-active="selected" ng-repeat="show in vm.shows">
<a ui-sref=".detail({ id: show.id })">{{ show.name }}</a> <a ui-sref=".detail({ id: show.id })">{{ show.name }}</a>
</li> </li>
</ul> </ul>