<!DOCTYPE html>
<html ng-app = "myApp">
<head>
<script data-require="angular.js@1.3.17" data-semver="1.3.17" src="https://code.angularjs.org/1.3.17/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="myController">
<div ng-controller="mySecondController">
<button ng-show="showButton">TEST</button>
</div>
</body>
</html>
// Code goes here
var myApp = angular.module('myApp', []);
myApp.factory('MenuService', function ($q,$http) {
var status= false;
var setStatus=function(newObj){
status=newObj;
};
var getStatus=function(){
return status;
};
return {
getStatus:getStatus,
setStatus:setStatus
}
});
myApp.controller('myController', function($scope, MenuService) {
$scope.showButton = false;
$scope.showButton = MenuService.getStatus();
});
myApp.controller('mySecondController', function($scope, MenuService) {
MenuService.setStatus(true);
$scope.showButton = MenuService.getStatus();
});
/* Styles go here */