Dear all,
I face issue while i try to get scope of element by 
angular.element().scope().

It alwasy returns top scope (which contains new messages.)

I created angular directive, which populate messages. which is used in 
layout page. layout page has ng-view. Actually i want to get ng-view $scope 
data in javascript. make some operation on it (displaying chart).

here bellow some sample code given

*Messge directive*

var module = angular.module("adminMessages", []);
module.directive("newMessages", function () {
    return {
        restrict: "E",

        templateUrl: "Components/newMessages.html",
        scope: {}
        
    };
});

*Html*

<div class="row">
   <newMessages></newMessages>
</div>

<div class="container">
<ng-view>
</div>

*model*

var module = angular.module("adminModule", ["ngRoute", "adminMessages", 
"adminServices"]);

module.constant("AdminDomain", "http://localhost:50870/admin";);

module.config(function ($routeProvider) {

    $routeProvider.when("/test", {
        templateUrl: "/ng-views/test.html"
    });

    $routeProvider.when('/dashBoard', {
        controller: "DashBoardController",
        resolve: {
            appCount: ["GetApplicationAccess", function 
(GetApplicationAccess) {
                return GetApplicationAccess();
            }]
        },
        templateUrl: '/ng-views/dashBoard.html'
    })

    $routeProvider.otherwise({

        redirectTo: "/"
    });
});


var module = angular.module("adminModule");


module.controller('DashBoardController', ['$scope', 'appCount',
    function dashBoardController($scope, appCount) {
        $scope.ApplicationHits = appCount;
        $scope.Data = "my data";
    }]);



Now I am unable to get DashBoardController scope (ApplicationHits) by using 
bellow javascript in dashboard html 

<script type="text/javascript">
        //ApplicationHits
        $(document).ready(function () {
            debugger
            var scope = angular.element($("#morris-chart-area")).scope();
          
            var sc = scope;

            sc = scope;

            console.log(sc);

            $("#morris-chart-area").append("Totla count <b> " + scope + 
"</b>");
            //alert(scope);

        });
    </script>


I have also attached image. as in console i can see property 
(ApplicationHits). but in java script/debug it is undefined.

Please help for this.




*Also I am using all this for mirror.js chart. Is there any way, where i 
can integrate mirror.js charts with angular*

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to