mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fix Like component to be reactive on change of nodeId parameter (#2717)
This commit is contained in:
committed by
Eugenio Romano
parent
16428a8109
commit
a2e6ee4c95
@@ -60,6 +60,8 @@ describe('Like component', () => {
|
||||
}
|
||||
|
||||
it('should load the likes by default on onChanges', async(() => {
|
||||
component.ngOnChanges();
|
||||
|
||||
simulateResponseWithLikes(2);
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { RatingService } from './services/rating.service';
|
||||
|
||||
@Component({
|
||||
@@ -25,7 +25,7 @@ import { RatingService } from './services/rating.service';
|
||||
providers: [RatingService],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class LikeComponent implements OnInit {
|
||||
export class LikeComponent implements OnChanges {
|
||||
|
||||
@Input()
|
||||
nodeId: string;
|
||||
@@ -39,7 +39,7 @@ export class LikeComponent implements OnInit {
|
||||
|
||||
constructor(private ratingService: RatingService) {}
|
||||
|
||||
ngOnInit() {
|
||||
ngOnChanges() {
|
||||
this.clean();
|
||||
|
||||
this.ratingService.getRating(this.nodeId, this.ratingType).subscribe(
|
||||
|
Reference in New Issue
Block a user