I'm building a web application based on the frameworks specified in the title:
My implementation strategy is as follows:
load Material-UI: it works >> I tried (within js/directives.js):
console.log(mui);
and the output is:
Object {AppBar: function, AppCanvas: function, Checkbox: function, DatePicker: function, Dialog: function…}
which is a set of Material Design components as expected.
js/directives.js file (included within script in index.html) is made of the following code:
/* define directives for ngReact's Material-Ui components */
angular.module('myapp.reactDirectives', [])
.directive('RaisedButton', function(reactDirective) {
return reactDirective(mui.RaisedButton);
});
Now, everything looks fine but it looks like AngularJS is ignoring my .directive function call as when I use (in one of my views):
<RaisedButton label="Primary" primary={true} />
as explained in ngReact's documentation, there is no output at all.
Indeed is seems the DOM is not altered by React's Virtual DOM:
<raisedbutton label="Primary" primary="{true}" class="ng-scope"></raisedbutton>
In the .directive definition I tried:
Any clue is greatly appreciated.
You need to follow angular rules when using directives. The directive name raisedButton should be used in markup as <raised-button>. (Change directive name from RaisedButton to raisedButton).
The directive attributes can only be strings, so using primary="{true}" like in React is probably not what you wanted.
Try this:
<raised-button label="Primary" primary="true"></raised-button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With