Commit 0da8c63100d6997075ac03c37b42815ee2b23117
1 parent
7e3d3b37
Exists in
master
and in
1 other branch
Fix getting name of a block
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/app/components/noosfero-blocks/block.component.ts
@@ -11,7 +11,7 @@ export class Block { | @@ -11,7 +11,7 @@ export class Block { | ||
11 | @Input() owner: any; | 11 | @Input() owner: any; |
12 | 12 | ||
13 | ngOnInit() { | 13 | ngOnInit() { |
14 | - let blockName = this.block.type ? this.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : "default-block"; | 14 | + let blockName = (this.block && this.block.type) ? this.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : "default-block"; |
15 | this.$element.replaceWith(this.$compile('<noosfero-' + blockName + ' [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-' + blockName + '>')(this.$scope)); | 15 | this.$element.replaceWith(this.$compile('<noosfero-' + blockName + ' [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-' + blockName + '>')(this.$scope)); |
16 | } | 16 | } |
17 | 17 |