controllers.js 2.43 KB
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope, $timeout) {
  $scope.channels = CHANNELS;
})
.controller('HomeCtrl', function($scope) {

})
.controller('ChannelCtrl', function($scope, $stateParams) {
  $scope.channel = $stateParams.channel;
  $scope.category_object = CHANNELS[$stateParams.channel];
})
.controller('CategoryCtrl', function($scope, $stateParams, posts) {
  $scope.channel = $stateParams.channel;
  $scope.category = $stateParams.category;
  $scope.category_name = CHANNELS[$stateParams.channel].cate[$stateParams.category];
  $scope.posts = posts;
  if(posts.length == 1){
    $scope.post = posts[0];
  }
})
.controller('PostCtrl', function($scope, $stateParams, post) {
  $scope.channel = $stateParams.channel;
  $scope.category = $stateParams.category;
  $scope.flag     = $stateParams.flag;
  $scope.post = post;
})
.controller('DevicesCtrl', function($scope) {
  $scope.items = [
    {src: '/images/devices/01.jpg', thumb: '/images/devices/thumb-01.jpg', sub: ''},
    {src: '/images/devices/02.jpg', thumb: '/images/devices/thumb-02.jpg', sub: ''},
    {src: '/images/devices/03.jpg', thumb: '/images/devices/thumb-03.jpg', sub: ''},
    {src: '/images/devices/04.jpg', thumb: '/images/devices/thumb-04.jpg', sub: ''},
    {src: '/images/devices/05.jpg', thumb: '/images/devices/thumb-05.jpg', sub: ''},
    {src: '/images/devices/06.jpg', thumb: '/images/devices/thumb-06.jpg', sub: ''},
    {src: '/images/devices/07.jpg', thumb: '/images/devices/thumb-07.jpg', sub: ''},
    {src: '/images/devices/08.jpg', thumb: '/images/devices/thumb-08.jpg', sub: ''},
    {src: '/images/devices/09.jpg', thumb: '/images/devices/thumb-09.jpg', sub: ''},
    {src: '/images/devices/10.jpg', thumb: '/images/devices/thumb-10.jpg', sub: ''},
    {src: '/images/devices/11.jpg', thumb: '/images/devices/thumb-11.jpg', sub: ''},
    {src: '/images/devices/12.jpg', thumb: '/images/devices/thumb-12.jpg', sub: ''},
    {src: '/images/devices/13.jpg', thumb: '/images/devices/thumb-13.jpg', sub: ''},
    {src: '/images/devices/14.jpg', thumb: '/images/devices/thumb-14.jpg', sub: ''}
  ];
})
.controller('WssjCtrl', function($scope) {
  
})
.controller('BgcxCtrl', function($scope) {

})
.controller('GsjjCtrl', function($scope) {
  var video = document.getElementsByTagName('video')[0];
  var width = video.parentElement.clientWidth - 20;
  video.width = width;
  video.height = width / (300 / 170.0);
  // $scope.play = function(){
  // }
});