Base solution for your next web application
Open Closed

Access Directives from AboutUs page #3907


User avatar
0
avanekar02 created

Hello ,

i have the following directivesm i need to access from the AboutUs.cshtm page , can you please tell me how to do it.

Regard Anwar

(function (app) { 'use strict';

app.directive('componentRating', componentRating);

function componentRating() {
    return {
        restrict: 'A',
        link: function ($scope, $element, $attrs) {
            $element.raty({
                score: $attrs.componentRating,
                halfShow: false,
                readOnly: $scope.isReadOnly,
                noRatedMsg: "Not rated yet!",
                starHalf: "../Common/Images/raty/star-half.png",
                starOff: "../Common/Images/raty/star-off.png",
                starOn: "../Common/Images/raty/raty/star-on.png",
                hints: ["Poor", "Average", "Good", "Very Good", "Excellent"],
                click: function (score, event) {
                    //Set the model value
                    $scope.vm.courseeducators.educatorId = score;
                    $scope.$apply();
                }
            });
        }
    }
}

});


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @avanekar02,

    About page is not an angularJs page. You need to modify it if you want to use this directive in it.

    Basically you need to create another angular app and include this directive in it. You can check main angularJs app here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/App/common/views/layout/layout.cshtml">https://github.com/aspnetzero/aspnet-ze ... out.cshtml</a>.

    But I think this is not a good way to use a directive in public part of website. It will cost you more time than you will gain using it.

    Thanks.