Skip to content

Instantly share code, notes, and snippets.

@brianpetro
Created August 18, 2016 17:04
Show Gist options
  • Save brianpetro/9eec231c64662d30bca147830c07aad6 to your computer and use it in GitHub Desktop.
Save brianpetro/9eec231c64662d30bca147830c07aad6 to your computer and use it in GitHub Desktop.
<body>
<div ng-app="myApp">
<div ng-controller="ctrl1">
<div style="background-color: green; width: 100px"
ng-if="switch1">light 1</div>
</div>
</div>
<script>
angular.module('myApp', [])
.controller('ctrl1', function (
$scope, $interval) {
$scope.switch1 = true;
$interval(function () {
$scope.switch1 = !
$scope.switch1;
}, 1000);
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment