Skip to content

Instantly share code, notes, and snippets.

@d-nation
d-nation / custom_compare.controller.js
Last active February 10, 2017 03:28
Custom Compare in $watch
var attributeChange = false;
$scope.somethingOnScope = {};
$scope.somethingOnScopeLast = {};
$scope.$watch(customScopeCompare, function(){ /* Handle changes */ });
function customScopeCompare() {
if (!equal($scope.somethingOnScope, $scope.somethingOnScopeLast)) {
attributeChange = !attributeChange;
}
return attributeChange;
@d-nation
d-nation / broadcast-interface.service.ts
Last active November 30, 2016 16:19
NG2->NG1 Broadcast Messages
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class BroadcastInterfaceService {
public ng1Broadcasts: Subject<string>;
public ng2Broadcasts: Subject<string>;
constructor() {