# 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');

## Usage

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

### Parameters

- `property_chain – {string} –`

  String representing name of a scope property. Optionally properties can be chained with `.` (dot), e.g. `'person.name.first'`

- `value – {*} –`

  Value to assign to the scope property.