text:
Q: Angular directive "=" value binds to scope, but is undefined? I have defined the following directive inside my Angular app:
(function() {
    'use strict';

    angular
    .module('almonds')
    .directive('security', ['$animate', 'AuthFactory', directive]);

    function directive($animate, AuthFactory) {
        var directive = {
            restrict: 'EA',
            scope: {
                operation: "@",
                clearance: "@",
                project: "="
            },
            link: linkFunc
        };

        return directive;

        function linkFunc($scope, $element, $attr, ctrl, $transclude) {
            var block, childScope, previousElements;

            console.log($scope.project);

            if($scope.project) {
                var projectId = $scope.project.id;
            }

            var operation = $scope.operation;
            var clearance = $scope.clearance;

            if (projectId) {
                var value = AuthFactory.hasProjectAccess(projectId, clearance);
                console.log('PROJECT SECURITY:', projectId, clearance, value);
            } else {
                var value = AuthFactory.hasAccess(operation, clearance);
                console.log('ORG SECURITY:', operation, clearance, value);
            }
        }
    }
// Controller.$inject = ['$scope'];
//
// function Controller($scope) {
//     var vm = this;
//
//     activate();
//
//     function activate() {
//
//     }
// }
})();

It is to be used as an element that receives either an operation or project value as well as a clearance value, which will then be used whether said element will render (I omitted that part but it's functionality is basically the same as ng-if).
Here's an example of it in use:

What's happening though, is that even though vm.project is indeed defined, that console.log($scope.project); yields undefined. Interestingly, if I simply console.log($scope); it will contain a project property with the information I need. What am I doing wrong?
I actually only need the project's id value, so I can either pass in the entire project object and access its id within the directive, or somehow pass the id number alone.

A: When your directive's link function starts executing, vm.project is undefined at that point. Set a watch on $scope.project.
Inside Directive:
$scope.$watch('project', function (newValue, oldValue) {
    if (newValue) {
        // do stuff
    }
});

redpajama_set_name: RedPajamaStackExchange


India's health insurance scheme, Rashtriya Swasthya Bima Yojna (RSBY) was initiated in 2008 to provide health insurance to poor households across India to protect them from major health shocks that push them into poverty and indebtedness. Recently, there has also been increasing interest in the potential indirect effects of social health protection programmes like RSBY which are promoted through principles of solidarity and equity, to support economic productivity, empowerment and social outcomes more broadly.
The aim of this study was to analyse the effects of RSBY on socially excluded households (focusing on Scheduled Castes and Muslims) in two states in India: Uttar Pradesh and Maharashtra. RSBY provides inpatient treatment of up to 30,000 Indian Rupees (approximately US$480) per year for five members of a household at a cost of Rs 30 (approximately US$0.48) as an annual household registration fee.
1. Has RSBY membership reduced socially excluded households' out-of-pocket health expenditure? What are the experiences of socially excluded households in terms of the healthcare received?
2. Has RSBY membership improved economic productivity opportunities for socially excluded households?
3. Has RSBY contributed to improved household wellbeing (e.g. food security and access to other services) for socially excluded households?
4. Does RSBY membership contribute to a change in social relations (e.g. community relations or participation in community activities)?
5. Does RSBY affect state–society relations (e.g. local government accountability or citizen perceptions of the state)?