This file contains hidden or 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
var users = [ | |
{ firstName: "Ldmarz", lastName: "martinez", age: 28, gender: "male" }, | |
{ firstName: "Suli", lastName: "bern", age: 5, gender: "female" }, | |
{ firstName: "Marianis", lastName: "Carrey", age: 54, gender: "female" }, | |
{ firstName: "Jhon", lastName: "carret", age: 40, gender: "male" } | |
]; | |
var femaleUsers = _.filter(users, function(user) { | |
return user.gender === 'female' | |
}); |
This file contains hidden or 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 someDirtyArray = [0, 1, false, 2, '', 3]; | |
const cleanedArray = _.compact(someDirtyArray); | |
// cleanedArray => [1, 2, 3] |
This file contains hidden or 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
<some-parent-component> | |
<button (click)="callChildFunction()" > call child function </button> | |
<some-child-component></some-child-component> | |
</some-parent-component> |
This file contains hidden or 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 { Component, ViewChild } from '@angular/core'; | |
import { SomeChildComponent } from './someChild/someChild.component'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
@ViewChild(SomeChildComponent) someChildComponent; |
This file contains hidden or 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 { HomePage } from '../pages/home/home'; | |
@NgModule({ | |
declarations: [ | |
MyApp, | |
HomePage | |
], | |
. . . | |
entryComponents: [ | |
MyApp, | |
HomePage |
This file contains hidden or 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 query = 'old man && scalzi'; | |
const result = fuseWithOperators(query, mockData); | |
// → [{"title": "Old Man's War", "author": {"firstName": "John", "lastName": "Scalzi"}}] |
This file contains hidden or 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 ngRedux from 'ng-redux'; | |
import { combineReducers } from 'redux'; // Usefull function to combine multiple reducers | |
import reducers from './redux/reducers/'; | |
angular | |
.module('app', [ngRedux]) | |
.config(($ngReduxProvider) => { | |
let reducer = combineReducers(reducers); | |
$ngReduxProvider.createStoreWith(reducer); // Aditionally here we can add middlewares like redux-logger | |
}) |
This file contains hidden or 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 { GODOWN, GOUP, ELEMENTS } from '../actions.type'; | |
const initialState = { | |
currentActive: 0, | |
elements: [] | |
} | |
function listReducer(state = initialState, action) { | |
switch (action.type) { | |
case GODOWN: |
This file contains hidden or 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 { GODOWN, GOUP, ELEMENTS} from '../actions.type'; | |
function actionGoUp() { | |
return { | |
type: GODOWN | |
}; | |
} | |
function actionGoDown() { | |
return { |
This file contains hidden or 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
export const GOUP = 'GOUP'; | |
export const GODOWN = 'GODOWN'; | |
export const ELEMENTS = 'ELEMENTS'; |