diff options
| author | Igor Minar | 2010-11-24 18:07:11 -0800 | 
|---|---|---|
| committer | Igor Minar | 2010-11-24 18:07:11 -0800 | 
| commit | 9c9a89f7ff6fa964bad6437d30cb0651f8366e8f (patch) | |
| tree | dd96e828176b913db5b868601867c34918a9c8d0 /src/Scope.js | |
| parent | 73194009a9ecc64d7243c1bf5dd6248408fe32c6 (diff) | |
| download | angular.js-9c9a89f7ff6fa964bad6437d30cb0651f8366e8f.tar.bz2 | |
docs for angular.scope. and angular.scope.
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 51 | 
1 files changed, 51 insertions, 0 deletions
| diff --git a/src/Scope.js b/src/Scope.js index b7f553d6..673e6e84 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -261,7 +261,58 @@ function createScope(parent, providers, instanceCache) {       * @param {function()} fn Function to be bound.       */      $bind: bind(instance, bind, instance), + + +    /** +     * @workInProgress +     * @ngdoc function +     * @name angular.scope.$get +     * @function +     * +     * @description +     * Returns the value for `property_chain` on the current scope. Unlike in JavaScript, if there +     * are any `undefined` intermediary properties, `undefined` is returned instead of throwing an +     * exception. +     * +       <pre> +         var scope = angular.scope(); +         expect(scope.$get('person.name')).toEqual(undefined); +         scope.person = {}; +         expect(scope.$get('person.name')).toEqual(undefined); +         scope.person.name = 'misko'; +         expect(scope.$get('person.name')).toEqual('misko'); +       </pre> +     * +     * @param {string} property_chain String representing name of a scope property. Optionally +     *     properties can be chained with `.` (dot), e.g. `'person.name.first'` +     * @returns {*} Value for the (nested) property. +     */      $get: bind(instance, getter, instance), + + +    /** +     * @workInProgress +     * @ngdoc function +     * @name angular.scope.$set +     * @function +     * +     * @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. +     * +       <pre> +         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'); +       </pre> +     * +     * @param {string} property_chain String representing name of a scope property. Optionally +     *     properties can be chained with `.` (dot), e.g. `'person.name.first'` +     * @param {*} value Value to assign to the scope property. +     */      $set: bind(instance, setter, instance), | 
