Object Properties: An Object is a non primitive data with collection of properties(key, value). Each property(key) of an Object has following configurable properties, value - value of the property. Default: undefined enumerable - if true, the property can be accessed using a for..in loop and Object.keys . Default: false writable - if true, the property value can be modified. Default: false get - defines a getter function. Default: undefined set - defines a setter function . Default: undefined configurable - if true, all the properties can be modified and deleted. Default: false With Object.defineProperty and Object.defineProperties we can set the above configurable properties for an Object property(key). With Object.getOwnPropertyDescriptor and Object.getOwnPropertyDescriptors we can get the above configurable properties associated with an Object property(key)...
This might be a simple angular filter, but more helpful to reduce ugly code in your controller. Angular provides '$interpolate' service to evaluate angular expressions. Consider you have some constant template with some expression expecting a dynamic value - lets say userName. Example: //example.js angular.module('app.example',[]) .constant('TEMPLATE',{ WELCOME_MSG: 'Hi {{userName}} Welcome to our Portal' }) .controller('sampleCtrl', function($scope, TEMPLATE, $interpolate){ $scope.data = { userName:'Ajai' }; $scope.MSG = $interpolate(TEMPLATE.WELCOME_MSG)($scope.data); }); <!--example.html--> <div ng-app="app.example" ng-controller="sampleCtrl"> <h1>{{MSG}}</h1> </div> Instead you can simplify the above one with custom interpolate filter. Below example wont make much difference, but consider if you have some 100 template constants - ...