在Angular 1.x中使用React-data-grid

时间:2017-01-17 21:51:42

标签: angularjs reactjs react-data-grid

我安装了ngReact,我可以使用这篇文章在我的Angular 1.3项目中创建一个基本组件(Hello World):https://www.logilab.org/blogentry/7366955

但我不确定如何在我的Angular应用程序中使用react-data-grid。使用什么组件名称?有没有人这样做过?我会欢迎一点指导! 谢谢!

1 个答案:

答案 0 :(得分:0)

只要阅读你的文章就不太了解角度,你需要做一些事情。

您需要将react-data-grid作为脚本导入,您可以检查它们的执行方式in here

在您可以使用ReactDataGrid组件之后,您可以对链接中的示例执行相同的操作。如果你不使用jsx,那么看看in here会更好。你的最终代码将是这样的

 // define a React component that displays "Hello {name}"
 var GridComponent = React.createClass({
    render: function() {
       var props = { x: this.props.x, y: this.props.y ...};
       // you can filter the props or just inject this.props
       return React.createElement(ReactDataGrid, props, null);
    }
 });

要使用它,您只需要创建看起来像这样的网格控制器:

 <div ng-app="app" ng-controller="helloController">
   <react-component name="GridElement" props="yourProps" />
 </div>