a[href*=#]
a[href*="#"]
var delay = 1000,
timer;
document.getElementById('text').addEventListener('input', function() {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(function() {
alert('Можно отсылать')
}, delay);
});
<Button onClick={resetUsers.bind(this)} >Gotcha!</Button>
this.handleAlertDismiss = this.handleAlertDismiss.bind(this);
пишемthis.state.resetUsers = this.state.resetUsers.bind(this);
constructor() {
super(...props);
this.handleAlertDismiss = this.handleAlertDismiss.bind(this);
this.state = {
showModal: true,
resetUsers: this.handleAlertDismiss
};
}
markers[i].addListener('click', (function(i) {
return function() {
markersPopup[i].open(map, markers[i]);
};
})(i));
$('h1').prevAll('img').wrapAll('<div class="group"></div>');
$('h1').nextAll('img').wrapAll('<div class="group"></div>');
var $h1 = $('h1'), methods = ['prevAll', 'nextAll'];
methods.forEach(function(method) {
$h1[method]('img').wrapAll('<div class="group"></div>');
});
import {Component, Inject, NgZone} from 'angular2/core'; // import NgZone
...
constructor(@Inject(UsersService) private UsersService, private zone:NgZone) {
UsersService.users.subscribe(newUsers => {
this.zone.run(()=> {
this.currentUsers = newUsers;
});
});
UsersService.fetchUsers();
}
var book = {
author__1: {
name: 'John',
surname: 'Smith'
},
author__2: {
name: 'John',
surname: 'Smith'
}
};
var max = Object.keys(book).length;
for (var i = 1; i <= max; i++) {
console.log(book['author__' + i].name);
}
$('#addFields').on('click', adminFields.addFields);
$('#addFields').on('click', function() {
adminFields.addFields();
});
$('#addFields').on('click', adminFields.addFields.bind(adminFields));
interface IterableIterator<T> extends Iterator<T> {
[Symbol.iterator](): IterableIterator<T>;
}
class Node {
public id: number;
constructor(id: number){
this.id = id;
}
}
class List {
public nodeAll: Node[];
constructor(nodeAll: Node[]){
this.nodeAll = nodeAll;
}
iterator(): IterableIterator<Node> {
return this.nodeAll[Symbol.iterator]();
}
}
let list = new List([new Node(0), new Node(1), new Node(2)]);
let iterator: IterableIterator<Node> = list.iterator();
for(let node of iterator){
console.log(node.id);
}
EXCEPTION: Error during instantiation of LocationStrategy! (RouterLink -> Router -> Location -> LocationStrategy).
import {bootstrap} from 'angular2/platform/browser';
import {App} from './app';
import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {provide} from 'angular2/core';
bootstrap(App, [
ROUTER_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy })])
.catch(err => console.error(err));
module.exports = function(location, cb) {
if (typeof require.ensure == 'function') {
require.ensure([], (require) => {
cb(null, require('./Reports'))
}, 'reports'); // третий параметр
} else {
cb(null, require('./Reports'));
}
}
var arr1 = [2,3,4],
arr2 = [4,5,6,7,8];
var isExists = arr1.some(function(x) { return arr2.indexOf(x) > -1; });
console.log(isExists);
headers.append("Access-Control-Allow-Origin", "*");
headers.append("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, PATCH, DELETE");
headers.append("Access-Control-Allow-Headers", "X-Requested-With,content-type");
headers.append('Content-Type', 'application/json');
в GET запросах вроде не нуженthis.http.get('localhost:6060/api/v1/userinfo'
XMLHttpRequest cannot load localhost:6060/api/v1/auth.
w.Header().Set("Access-Control-Allow-Methods", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")