Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
252
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('timesheet')
  2.   .directive('weekEntry', function () {
  3.  
  4.     function onUpdate(newData) {
  5.       if (!newData[0] || !newData[1]) {
  6.         return;
  7.       }
  8.  
  9.       var component = WeekEntryComponent({
  10.         rows: newData[1].companies,
  11.         clients: newData[0],
  12.         saveMethod: scope.saveTimesheet
  13.       });
  14.  
  15.       React.renderComponent(component, element.find('#weekEntry')[0]);
  16.     }
  17.  
  18.     return {
  19.       restrict: 'A',
  20.       link: function (scope, element) {
  21.         scope.$watchCollection('[clients, model]', onUpdate);
  22.       }
  23.     };
  24.   });
Advertisement
RAW Paste Data Copied
Advertisement