0

I am implementing meta tags in angularjs using this code :

.state('home', {
    url: "/home/",
    metaTags: {
        title: 'abc',
        description: 'xyz',
        keywords: 'xyz',
        properties: {
            'og:title': abc'
        }
    },
    views : {
        "" : {
            templateUrl:"/home/home.html",
            controller: 'homeCtrl',
            controllerAs:'vm',
        }
    },

    resolve: {
        loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
            return $ocLazyLoad.load('home'); // Resolve promise and load before view
        }]
    }
})

It is working fine because I fixed the meta tags but, I want to send dynamic data from a controller to mainApp.

In easy way , I want to send dynamic data from homeCtrl to mainApp.

Is there any way to do this in angularjs?

Thanks in advance.

Neeraj Kamat
  • 354
  • 3
  • 12
Sumit
  • 3
  • 7
  • you can try [$rootScope](https://stackoverflow.com/questions/18880737/how-do-i-use-rootscope-in-angular-to-store-variables) and [$emit and $broadcast](https://stackoverflow.com/questions/26752030/rootscope-broadcast-vs-scope-emit) – Ngoc Pham Jan 28 '19 at 09:35
  • it's better if you can give me some example or link of an example. @NgocPham, Bcoz I am new in AngularJs – Sumit Jan 28 '19 at 10:20

1 Answers1

0

https://docs.angularjs.org/api/ng/service/$rootScope (rootScope usage guide and doc) https://www.w3schools.com/angular/angular_scopes.asp (Usage examples)

Neeraj Kamat
  • 354
  • 3
  • 12