ianmurrays / ngDfp

DoubleClick For Publishers for Angular JS
MIT License
52 stars 40 forks source link

Cannot read property 'addService' of null Error #1

Open anasqadrei opened 10 years ago

anasqadrei commented 10 years ago

Hello

My ad is being displayed using dfp generated tags but it is not being displayed when I use ngDfp. The error I am getting the console when I use ngDFP is:

Uncaught TypeError: Cannot read property 'addService' of null    angular-dfp.js:57
(anonymous function)                                             angular-dfp.js:57
q                                                                angular.min.js:7
_initialize                                                      angular-dfp.js:56
(anonymous function)                                             angular-dfp.js:118

I'm using angular v1.3.0-beta.9

ianmurrays commented 10 years ago

How are you displaying your ads with ngdfp? I do get those errors and I haven't been able to figure out why they're occurring bug my ads do show. — Ian Murray S.

On Thu, Sep 11, 2014 at 10:51 PM, Anas Qadrei notifications@github.com wrote:

Hello My ad is being displayed using dfp generated tags but it is not being displayed when I use ngDfp. The error I am getting the console when I use ngDFP is:

Uncaught TypeError: Cannot read property 'addService' of null    angular-dfp.js:57
(anonymous function)                                             angular-dfp.js:57
q                                                                angular.min.js:7
_initialize                                                      angular-dfp.js:56
(anonymous function)                                             angular-dfp.js:118

I'm using angular v1.3.0-beta.9

Reply to this email directly or view it on GitHub: https://github.com/ianmurrays/ngDfp/issues/1

anasqadrei commented 10 years ago

I just followed the instructions and changed the ids to my ids

first step, I created angular-dfp.js in my project and then I copied and pasted the code from github.

/lib/ng-dfp/angular-dfp.js

second, I included the library at the bottom of my html page

<script src="/lib/angular/angular.min.js"></script>
...
<script src="/lib/ng-dfp/angular-dfp.js"></script>

third, I changed my my ng-app.js

var myApp = angular.module('myApp', [
...
'ngDfp',
...
]);

myApp.config([..., 'DoubleClickProvider', function(..., DoubleClickProvider) {
    DoubleClickProvider.defineSlot('/11xxxx09/test_wide_skyscraper', [160, 600], 'div-gpt-ad-14xxxxxxxxx61-0');
}]);

Finally, in my html page I added this line

<div data-ng-dfp-ad="div-gpt-ad-14xxxxxxxxx61-0"></div>
ianmurrays commented 10 years ago

Can you verify that the directive is actually doing something? Inspect the element and see if dfp is serving the ad?

Thanks!

anasqadrei commented 10 years ago

Not sure what happened here but now it is working.

Before I had both google dfp scripts and ngDfp scripts on my page to compare them. So when I wanted to inspect ngDfp, I removed all google dfp scripts and then ngDfp served ads successfully!

Maybe you can call the ad twice from the same page or something.

ianmurrays commented 10 years ago

Well that's it, you can't have a tag twice on a page, they're unique. 

I'll leave this ticket open since the error you described is technically still a bug though. 

Thanks.  — Ian Murray S.

On Thu, Sep 11, 2014 at 11:55 PM, Anas Qadrei notifications@github.com wrote:

Not sure what happened here but now it is working. Before I had both google dfp scripts and ngDfp scripts on my page to compare them. So when I wanted to inspect ngDfp, I removed all google dfp scripts and then ngDfp served ads successfully!

Maybe you can call the ad twice from the same page or something.

Reply to this email directly or view it on GitHub: https://github.com/ianmurrays/ngDfp/issues/1#issuecomment-55356142