title: conditionally checking check box in angularjs
body: <p>I have created a angular-meteor page for settings. In that settings page menus are listed and when a menu is selected then it is displayed in home page. When unchecked it is removed from dashboard. The code is</p>
  
  <p>in client side js `angular.module('demo').directive('generalSettings', function() {</p>
  
  <pre><code>return {
      restrict: 'E',
      templateUrl: 'client/lms/general-settings.html',
      controllerAs: 'generalSettingsCtrl',
      controller: function($scope, $reactive, $stateParams, $mdDialog, $state, $mdToast, ToastService, $timeout, $q, $log, errorValidatorUtil, CurrentPage) {
          $reactive(this).attach($scope)
          let self = this;
          let user = Meteor.user();
          let userId = Meteor.userId();
          let customerId = [userId]
          self.subscribe('getCustomerDetails', () =&gt; [customerId], {
              onReady: function() {
                  self.helpers({
                      currentUser: () =&gt; {
                          return Meteor.users.findOne({
                              _id: Meteor.userId()
                          });
  
                      }
                  })
              }
          });
          // console.log(Meteor.users.findOne({
          //     _id: Meteor.userId()
          // }))
  
          self.data = {};
          self.data.cb1 = true;
          self.isChecked = true;
          CurrentPage.setTitle('Settings');
          self.subscribe('generalSettingsDetails', () =&gt; [], {
              onReady: function() {
                  self.helpers({ /// helpers to make it reactive
                      generalSettings: () =&gt; {
                          let settings = GeneralSettings.find({}).fetch()
                              //var subSettings = []
                          for (key in settings) {
  
                              delete settings[key].$$hashKey
  
                          }
                          console.log(settings)
                          return {
                              'generalSetting': settings
                          };
                      }
                  })
              }
  
  
          });
          self.getClicked = (dynamicSetting, settingId, detail) =&gt; {
              self.dataArry = {};
              self.dataChk = {};
  
              self.generalSetting = {};
  
  
              console.log(self.generalSettings.generalSetting)
  
  
              Meteor.call("updateStatus", detail, function(error, result) {
                  if (error) {
  
                      ToastService.getToastbox($mdToast, 'Something went error!Unable to add details', 'error-toast');
                  } else {
                      self.generalSetting = {};
  
                      ToastService.getToastbox($mdToast, 'Details added successfully !', 'success-toast');
  
                  }
              });
  
  
          }
  
      }
  }
  </code></pre>
  
  <p>})
   and the server js is like`Meteor.methods({
      updateStatus: function(settings, status) {
          let _ids = []
          console.log(settings)
          if (settings.$$hashKey)
              delete settings.$$hashKey</p>
  
  <pre><code>    GeneralSettings.update({
          _id: settings._id
  
      }, {
          $set: {
              "status": settings.status
          }
      }, {
          "multi": true
      })
  }
  </code></pre>
  
  <p>})</p>
  
  <p>and the html is like</p>
  
  <pre><code>&lt;div layout="column" layout-wrap layout-padding layout-fill class="littleWhiteFrame" ng-cloak&gt;
  &lt;div&gt;
      &lt;div layout="row" class="requestDetailElems"&gt;
          &lt;h4 class="md-subhead" layout-marginSettings&gt; Settings&lt;/h4&gt;
          &lt;span flex&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;md-divider&gt;&lt;/md-divider&gt;
  &lt;div layout="row"&gt;
  &lt;fieldset class="standard"&gt;
      &lt;div layout-gt-sm="row"  ng-repeat="detail in generalSettingsCtrl.generalSettings.generalSetting"&gt;
          &lt;md-checkbox aria-label="Checkbox 1"  ng-model="detail.status" ng-change="generalSettingsCtrl.getClicked(generalSettingsCtrl.detail[$index],currentUser._id,detail)"&gt;
  
                 &lt;p&gt; {{detail.name}} {{ detail.data.cb1 }}&lt;/p&gt;
          &lt;/md-checkbox&gt;
      &lt;/div&gt;
      &lt;/fieldset&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>i have a mongo collection for settings with fields like id,name,description,tag,status.</p>
  
  <p>when the menu is selected status will get changed to true.</p>
  
  <p>Now I want to make some changes in this code,I want to make different menu for different users. So in the user collection I have to push the selected menu.
  For eg:user1,user2 if user1 selects home,about us from settings then in his dashboard home and aboutus should be viewed. if user2 selects home and testimonial then when he login home and testimonial should be viewed not home and aboutus</p>