changeArray(obj: any, title: string, desc: string){
let new_obj = obj;
new_obj['title'] = title;
new_obj['description'] = desc;
this.languages.splice(this.languages.indexOf(obj), 1, new_obj);
this.changeDetectorRef.detectChanges();
<div *ngFor="let lang of languages" (change)="changeArray(lang, title.value, desc.value)">
<hr>
<div class="form-group">
<label for="input01" class="col-sm-4 control-label">Title</label>
<div class="col-sm-8">
<input tabindex="1" type="text" class="form-control" [value]="lang.title" #title id="input01" placeholder="Title..."/>
</div>
</div>
<div class="form-group">
<label for="input02" class="col-sm-4 control-label">Description</label>
<div class="col-sm-8">
<input tabindex="2" type="text" class="form-control" value={{lang.description}} #desc id="input02" placeholder="Description..."/>
</div>
</div>
</div>
<code>
func (ar *ArticleResource) ArticlesList(c *iris.Context) {
page, _ := c.URLParamInt("page")
var articles []Article
var counts int64
ar.DB.Model(&Article{}).Count(&counts)
switch {
case page == 1:
ar.DB.Order("id desc").Limit(5).Find(&articles)
default:
ar.DB.Order("id desc").Limit(5).Offset(page * 5).Find(&articles)
}
c.JSON(iris.StatusOK, map[string]interface{}{"articles": &articles, "count":&counts})
}
$scope.min = Math.min.apply(null, $scope.products.map(function(a){return a.price}));
$scope.max = Math.max.apply(null, $scope.products.map(function(a){return a.price}));
<li class="filter-li" ng-repeat="category in categories">
<a ng-href="products/category/{{ category.seo_name }}" class="filter-link active" ng-if="category.level == 0">{{ category.name }}<span
class="filter-count">2.2k</span></a>
<ul class="filter-ul filter-2nd" ng-if="category.level > 0">
<li class="filter-li">
<a ng-href="products/category/{{ category.seo_name }}" class="filter-link active"> -> {{ category.name }}
<span class="filter-count">2.2k</span>
</a>
</li>
</ul>
</li>
[
{
"id": 3,
"name": "Ботинки",
"description": "",
"visible": true,
"products_count": 0,
"products_count_cache": 0,
"seo_name": "botinki",
"seo_title": "",
"seo_desc": "",
"seo_keywords": "",
"lft": 1,
"rght": 6,
"tree_id": 2,
"level": 0,
"parent": null
},
$scope.categoryFilter = function (products){
try {
if ($routeParams.categorySlug){
if ($routeParams.categorySlug == products.category.seo_name)
return products;
}else{
return $scope.products;
}
}
catch (TypeError) {
return;
}};
class ProductSerializer(serializers.ModelSerializer):
picture = ImageSerializer(read_only=True)
vendor = VendorSerializer()
class Meta:
model = Product
fields = (
'name', 'external_url', 'category', 'description', 'price', 'old_price', 'discount', 'discount_percent',
'popularity', 'order', 'click_count', 'redirect_count', 'visible', 'colors', 'sizes', 'currencies',
'picture', 'country_of_origin', 'manufacturer_warranty', 'vendor','recommended','id')
depth = 2