angular.scope.$set

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

Assigns a value to a property of the current scope specified via property_chain. Unlike in JavaScript, if there are any undefined intermediary properties, empty objects are created and assigned in to them instead of throwing an exception.

         var scope = angular.scope();
         expect(scope.person).toEqual(undefined);
         scope.$set('person.name', 'misko');
         expect(scope.person).toEqual({name:'misko'});
         expect(scope.person.name).toEqual('misko');
       

Dependencies

Usage

angular.scope.$set(property_chain, value);

Parameters