File: src/packages/common/components/data-view/directives/dataViewDirective.js

Recommend this page to a friend!
  Classes of Alien Fernandez   Seed Sails Angular   src/packages/common/components/data-view/directives/dataViewDirective.js   Download  
File: src/packages/common/components/data-view/directives/dataViewDirective.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Seed Sails Angular
Full stack framework based on Sails, Node, Angular
Author: By
Last change: Update of src/packages/common/components/data-view/directives/dataViewDirective.js
Date: 3 years ago
Size: 1,237 bytes
 

Contents

Class file image Download
import commonModule from '../../../commonModule'; import DataView from '../react-components/DataViewReact'; /** * @ngdoc directive * @name dataView * @author Alien Fernandez Fuentes <alienfernandez85@gmail.com> * @version 1.0.0 * * @description Directive data view * */ class DataViewDirective { constructor($compile) { let directive = { restrict: 'E', replace: true, //controller: DataViewController, template: `<div data-role="transclude" class="dv-main"> <span role="container"></span> </div>`, scope: { options: '=' }, link: ($scope, $element, $attrs, ngModel, transclude) => { //Render component with options React.render( React.createElement(DataView, $scope.options), $element.find('span[role="container"]')[0] ); //Compile react.js source $compile($element[0])($scope); } }; return directive; } } commonModule.directive('dataview', ['$compile', ($compile) => new DataViewDirective($compile)]); export default commonModule;