Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('myapp').service([function BarService() {
  2.  
  3.     this.bindOnThis = {
  4.         muted: true,
  5.         playing: false
  6.     };
  7.  
  8. }]);
  9.  
  10.  
  11. angular.module('myapp').controller(['$scope', 'BarService', function FooController($scope, BarService) {
  12.  
  13.     $scope.videoConfig = {
  14.         muted: false,
  15.         playing: false
  16.     };
  17.  
  18.     $scope.barServiceConfig = BarService.bindOnThis;
  19.  
  20.     $scope.$watch('barServiceConfig.muted', function(newValue) {
  21.  
  22.         if (newValue) {
  23.             $scope.videoConfig.muted = newValue;
  24.         }
  25.  
  26.     });
  27.  
  28. }]);
  29.  
  30. <video video-dtv is-muted="videoConfig.muted", is-playing="videoConfig.playing" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement