Comments (6)
Could you give me the code that produces this error ? Typescript and HTML.
from angular-pipes.
HTML:
<nav ngIf="metaCategories">
<ul class="nav nav-tabs">
<li ngFor="let category of metaCategories | objToArr | orderBy: 'position'" class="nav-item">
<a href="#" class="nav-link">
<i class="fa {{category.icon}}" title="{{category.name}}"></i>
</a>
</li>
</ul>
</nav>
TypeScript:
import {Component, OnInit} from '@angular/core';
import * as globals from '../../shared/globals';
import {ShareService} from "../../shared/share-service";
@Component({
selector: '[syLiveEditMetabar]',
inputs: ['syLiveEditMetabar'],
templateUrl: 'metabar.component.html',
styles: []
})
export class MetabarComponent implements OnInit {
private syLiveEditMetabar;
private metaCategories = [];
private metaConfiguration;
constructor(private shareService: ShareService) { }
ngOnInit() {
this.shareService.getPageData()
.subscribe(
result => {
if(result.metaConfiguration && !this.metaConfiguration) {
this.metaConfiguration = result.metaConfiguration;
/**
* Define used metaCategories
*/
for(var x = 0; this.metaConfiguration.groups.length != x; x++) {
if(globals.MetaCategories) {
for(var category in globals.MetaCategories) {
if(globals.MetaCategories[category].alias == this.metaConfiguration.groups[x].category) {
this.metaCategories[category] = globals.MetaCategories[category];
}
}
//this.metaConfiguration.groups[x]
}
}
console.log(this.metaCategories);
}
}
)
}
}
Result of the subscription (result.metaConfiguration) is:
{ groups: [ { name: "Seiten-Informationen", alias: "seiteninformationen", visible: false, position: "1", category: "Basicdata" }, { name: "Veröffentlichung", visible: false, position: "2", category: "Basicdata" }, { name: "Sicherheit", visible: true, position: "1", category: "Security" } ] , elements: [ { label: "Seiten-Titel", alias: "Titel", type: "text", group: "seiteninformationen", mandatory: true, validations: [ "min:3" ] }, { label: "Seiten-Alias", alias: "Alias", type: "text", group: "seiteninformationen", mandatory: false, validations: [] } ] };
Result of globals.MetaCategories is:
{ Basisdaten: { name: 'Basisdaten', alias: 'Basicdata', icon: 'fa-info', position: 4 }, Security: { name: 'Sicherheit', alias: 'Security', icon: 'fa-users', posiiton: 2, }, Settings: { name: 'Einstellungen', alias: 'Settings', icon: 'fa-wrench', position: 3 } };
from angular-pipes.
objToArr
is one of your own pipe ?
from angular-pipes.
Yes.
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'objToArr',
pure: false
})
export class ObjToArr implements PipeTransform {
/**
* Pipe (filter) to transform an object to an array
* @param object
* @returns {Array}
*/
transform(object: any) {
var newArray = []
for (var key in object) {
newArray.push(object[key]);
}
return newArray;
}
}
from angular-pipes.
Could you maybe print what comes out of objToArr ? To check if it's really an array of numbers only.
from angular-pipes.
Unfortunately the result of objToArr results in something else than expected. Guess you can close this issue :) Thanks.
from angular-pipes.
Related Issues (20)
- The pipe 'bytes' could not be found HOT 1
- Orderby isn't working with date
- [feature request] pipe instanceof
- [Feature Request] IEC Byte Size Units
- Where Pipe HOT 1
- Build Fails - Angular V5 HOT 3
- Replace pipe only replaces the first found charcater HOT 1
- Created a fork HOT 2
- Create Ivy distribution HOT 3
- Modules Imports issues HOT 1
- Incorrect Ordinals HOT 5
- Add getOrElse pipe
- Add default (starting) value to sum pipe
- Show trailing zeros with bytes pipe
- BytesPipe does not support PB or EB
- Unable to use where pipe HOT 2
- Keep types when using pipes HOT 1
- Dynamic orderBy with dynamic ascending/descending HOT 1
- this undefined within where pipe HOT 2
- Where Not - negotiated value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-pipes.