'use strict';
var angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils']);

angularMeteorSession.factory('$meteorSession', ['$meteorUtils',
  function ($meteorUtils) {
    return function (session) {

      return {

        bind: function(scope, model) {
          $meteorUtils.autorun(scope, function() {
            scope[model] = Session.get(session);
          });

          scope.$watch(model, function (newItem, oldItem) {
            Session.set(session, scope[model]);
          }, true);

        }
      };
    }
  }
]);


'use strict';
var angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils']);

angularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse',
  function ($meteorUtils, '$parse') {
    return function (session) {

      return {

        bind: function(scope, model) {
          var getter = $parse(model);
          var setter = getter.assign;
          $meteorUtils.autorun(scope, function() {
            setter(scope, Session.get(session));
          });

          scope.$watch(model, function(newItem, oldItem) {
            Session.set(session, getter(scope));
          }, true);

        }
      };
    }
  }
]);


Use angular $parse to handle nested mode
Use angular $parse to handle nested mode

MeteorSession doesn't work with nested mode something link 'a.b.c'
Fix it by using angular $parse