RafaelVidaurre / angular-permission

Simple route authorization via roles/permissions
MIT License
1.13k stars 212 forks source link

permission-sref with dynamic access #431

Open hdi-amiri opened 7 years ago

hdi-amiri commented 7 years ago

Hi If I have dynamic access like following

            data: {
                permission: {
                    only: function (transitionProperties) {
                        if (transitionProperties.toParams.type === "A") {
                            return [PERMISSIONS.A];
                        } else if (transitionProperties.toParams.type === "B") {
                            return [PERMISSIONS.B];
                        }
                    }
                }
            }

I cannot use permission-sref in my view, any workaround for this?

AesSedai commented 7 years ago

+1, the data.permission.only function only runs when the transition is attempted instead of running with

<div permission permission-sref="'state'"></div>

in the view.