Allow script tags for ng-template
Replace toObject with toJSON and remove all now unrequired calls to toOject when serializing as JSON