This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const module = angular.module('toggle', []); | |
module.directive('toggle', function () { | |
return { | |
controllerAs: 'toggle', | |
bindToController: { | |
value: '=', | |
trueLabel: '@', | |
falseLabel: '@', | |
onToggle: '&' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const module = angular.module('toggle', ['react']); | |
const Toggle = (props) => ( | |
<div onClick={() => props.onToggle(!props.value)}> | |
<span className={props.value ? 'selected' : ''}> | |
{props.trueLabel || 'Yes'} | |
</span> | |
<span className={!props.value ? 'selected' : ''}> | |
{props.falseLabel || 'No'} | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<toggle value="value" | |
true-label="'True'" | |
false-label="'False'" | |
on-toggle="::onToggle"> | |
</toggle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const module = angular.module('toggle', ['react']); | |
const Toggle = (props) => ( | |
<div onClick={() => props.onToggle(!props.value)}> | |
<span className={props.value ? 'selected' : ''}> | |
{props.trueLabel || 'Yes'} | |
</span> | |
<span className={!props.value ? 'selected' : ''}> | |
{props.falseLabel || 'No'} | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('myComponent', ['reactDirective', '$ngRedux', function(reactDirective, $ngRedux) { | |
return reactDirective(MyComponent, null, {}, {store: $ngRedux}); | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {setLocation} from 'ng-redux-router'; | |
const push = url => setLocation(url); | |
export {push} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {stateGo} from 'redux-ui-router'; | |
const stateMap = { | |
'/': 'index', | |
'/page1': 'page1', | |
'/page2': 'page2' | |
} | |
const push = url => { | |
// getPath() and getParams() are example functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stateProvider.state('a-state', { | |
url: "/a-url", | |
template: '<a-react-container></a-react-container>' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular 1 | |
const module = angular.module('myModule', []); | |
module.component('myComponent', { | |
template: '<div>Hello World!</div>' | |
}); | |
/***************************************************************/ | |
// Angular 2 | |
import {Component} from '@angular/core'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular 1 | |
const module = angular.module('myModule', []); | |
module.component('myComponent', { | |
templateUrl: 'path/to/my/template.html' | |
}); | |
/***************************************************************/ | |
// Angular 2 | |
import {Component} from '@angular/core'; |
OlderNewer