I have a factory function that has some data and a some functions which manipulate it. This data is used several times in the application, at some points the data is on the page and then is also opened up in a modal- manipulating the data in the modal changes the data in the background page. What is the most 'angular way' to create separate instances of the data?
Updated:
The factory:
factory('filterFactory', [function () {
return {
    getGroups: function(term){
        // TODO: get terms groups with $http
        if(term){
            // get terms
        }
        else {
            return this.terms;
        }
    },
    addGroup: function(group){
        for (var term in this.terms) {
            if(this.terms[term].name === group){
                this.terms[term].included = true;
            }
        }
    },
    removeGroup: function(group){
        for (var term in this.terms) {
            if(this.terms[term].name === group){
                this.terms[term].included = false;
            }
        }
    },
    selectGroup : function(group){
        for (var term in this.terms) {
            if(this.terms[term].name === group){
                this.terms[term].included = true;
            } else {
                this.terms[term].included = false;
            }
        }
    },
    setAll : function(value){
        for (var term in this.terms) {
            this.terms[term].included = value;
        }
    },
    isCollapsed: true,
    terms: {
        people: {
            included: false,
            name: 'person',
        },
        organizations: {
            included: false,
            name: 'organization',
        },
        ...
    }
};
}]).
Attempted implementations:
    $scope.newTermMeta.type = filterFactory;
var temp = filterFactory;
$scope.newTermMeta.type = temp.terms;
$scope.newTermMeta.type = filterFactory.getGroups();
var temp = filterFactory;
$scope.newTermMeta.type = temp.terms;
$scope.newTermMeta.type = Object.create(filterFactory.getGroups());
note: none of the above implementations created an isolated instance.
Template Code:
<div class="modal-body">
    <form>
        <label> 
            <h2>{{newTermMeta.name}}</h2>
        </label>
        <br>
        <span>Add your term to relevant term groups:</span>
        <br>
        <div class="well well-sm col-sm-8">
            <button ng-repeat="group in newTermMeta.type" btn-checkbox class="btn btn-sm btn-default margin5" type="button" ng-model="group.included">{{group.name}}</button>
        </div>
        <br>
        <span>Optional:</span>
        <br>
        <label> Enter a concise (at most one sentence) definition for this term:</label>
        <input class="form-control width80p" type="text" ng-model="newTermMeta.definition">
    </form>
</div>