<div layout-gt-sm="row" ng-controller="PostReq as pr">
<md-input-container flex>
<label>Name</label>
<input type="text" ng-model="pr.catName"/>
</md-input-container>
<md-input-container flex >
<label>Color</label>
<input type="text" ng-model="pr.catColor"/>
</md-input-container>
<md-input-container flex >
<label>Age</label>
<input type="text" ng-model="pr.catAge"/>
</md-input-container>
<md-button class="md-raised md-warn" ng-click="pr.sendReq()">Create cat</md-button>
</div>
app.controller('PostReq', function ($scope, $http) {
$scope.sendReq = function() {
alert( $scope.catName);
var intAge = parseInt($scope.catAge);
$http({method: 'POST',
url: 'http://127.0.0.1:8000/api/cat/',
data: {name: $scope.catName, color: $scope.catColor, age: intAge}
});
}});
1. первый заход:
{
person: {
name: 'joe',
history: {
hometown: 'bratislava',
bio: {
funFact: 'I like fishing.'
}
}
}
2. второй заход
{
history: {
hometown: 'bratislava',
bio: {
funFact: 'I like fishing.'
}
}
3. третий заход
{
hometown: 'bratislava',
}
var pdf = new jsPDF('p', 'pt', 'a4');
app.filter('filterMaterials', function () {
return function (materials, wood, plastic) {
var filteredMaterials = [];
for (var i = 0; i < materials.length; i++) {
if (materials[i].type === wood || materials[i].type === plastic) {
filteredMaterials.push(materials[i]);
}
}
return filteredMaterials;
};
});
<tr data-ng-repeat="material in materials | filterMaterials:search.wood:search.plastic">
<td>{{material.name}}</td>
<td>{{material.type}}</td>
<td>{{material.price}}</td>
</tr>
<input type="checkbox" data-ng-model='search.wood'/>
<input type="checkbox" data-ng-model='search.plastic'/>
app.directive ('dayCol', function ($compile) {
return {
restrict: 'С',
link: link
};
function link(scope, element, attr) {
element.bind('click', function() {
var addEvent = $compile('<add-event></add-event>')(scope);
element.append(addEvent);
});
}
});
// routes/route1.js
module.exports = [
{
method: 'GET', path: '/routes1',
handler: function () {} },
{
method: 'GET', path: '/routes1/{id}',
handler: function () {} }
];
// /routes/index.js
var route1 = require('./route1');
var route2 = require('./route2');
var route3 = require('./route3');
var routeN = require('./routeN');
module.exports = [].concat(route1, route2, route3, routeN);
// /server.js
var routes = require('./routes');
server.route(routes);
data.reduce(function (result, o) {
var key = o.user;
var counter = 1;
if (!(key in result)) {
result.arr.push(result[key] = {
user: o.user,
couter: counter,
total: o.sum
});
} else {
result[key].total += o.sum;
counter++;
}
return result;
}, { arr: [] }).arr;
var key = o.driver;
import React, { Component } from 'react';
import { BarChart } from 'react-d3';
export class first extends Component {
constructor(...args) {
super(...args);
this.state = {};
}
render() {
// необходимо заранее назначить на переменую список с минимальными данными включая ключи "name"и "values"
var data = [
{
name: "series1",
values: [ { x: 0, y: 20 }, { x: 24, y: 10 } ]
},
{
name: "series2",
values: [ { x: 70, y: 82 }, { x: 76, y: 82 } ]
}
];
return (
<div>
<h1>First Chart</h1>
<BarChart
data={data}
width={500}
height={200}
fill={'#3182bd'}
/>
</div>
);
}
}
export default first;
var options = {
url: 'https://vk.com',
proxy: 'http://login:password@XXX.XXX.XXX.XXX:YYYY',
method: 'POST',
headers: headers,
strictSSL: false
};