I need to provide a solid HTML string to my maps marker baloon body.
I want to make the baloon an Angular component and use bindings and built-in directives (*ngFor, *ngIf, etc).
So Im looking for a way to evaluate all bindings in component template and compile result to a string...
How to achieve this or if this approach is non-angular - what could be the pattern recommended?
// Component
import {Component} from '@angular2/core';
import {AnyThing} from './somewhere/in/my/app/anything.model.ts';
@Component({
selector: 'my-baloon-window',
template: `<p>This is a baloon for {{ any.name }}</p>`
})
export class MyBaloonWindowComponent {
constructor(public something: AnyThing) {}
}
// Implementation
import {AnyThing} from './somewhere/in/my/app/anything.model.ts';
import {MyBaloonWindowComponent} from './path/to/baloon-window.component';
/* { ...some code here... } */
private createBaloonWindow(thing: AnyThing): google.maps.InfoWindow {
return new ymap.map.BaloonWindow({
/* I want something like this */
content: new MyBaloonWindowComponent(thing).toString()
/* ^ this is what I want ^ */
});
}
from '@angular2/core';You seem to be kidding