Hi Prudhvi, the objects in injectParams and the function arguments need to be in the exact same order. Thats the problem here <https://gist.github.com/prudvihemanth/fc88ec2456c5c29f1709>.
like this: var injectParams = ['$scope','$rootScope’, “…”] var controller = function ($scope, $rootScope, …] Best, P > On 08 Oct 2015, at 14:21, Prudvi Seshu <[email protected]> wrote: > > Hi Philipp, > > I have checked the examples and when initializing mapboxService in the > controller function it is throwing error. Can you please tell me how to > properly initialize map box service in controller. > > I have a parent controller app.js, There i have initialized the > angular-mapbox directive. I want to access the mapboxService in the > admincontroller.js. I am sending the gist files of app.js and > admincontroller.js can you please tell me where i am going wrong.. > > app.js file: > https://gist.github.com/prudvihemanth/b670432816c10e5ce900 > admincontroller.js file: > https://gist.github.com/prudvihemanth/fc88ec2456c5c29f1709 > > I have included the mapbox.js and angular-mapbox.js files in the index.html > page. > > Regards, > Prudhvi > > On Thursday, October 8, 2015 at 5:37:55 PM UTC+5:30, plitzenberger wrote: > Hi Prudhvi, > > have you checked out the examples > <https://github.com/licyeus/angular-mapbox/tree/master/examples>? There you > find the file example-app.js > <https://github.com/licyeus/angular-mapbox/blob/master/examples/example-app.js#L7> > with the initialisation of the mapboxService. > > Best, > Philipp > >> On 08 Oct 2015, at 12:25, Prudvi Seshu <[email protected] <javascript:>> >> wrote: >> >> Hi Philipp, >> >> Thanks for the reply, I have removed the angular-mapbox and checked with >> <mapbox map-id="YOUR-MAP-ID" lat="47.603569" lng="-122.329453"></mapbox> in >> my html. It says 401 Unauthorized in the console and map is not displaying. >> I think we have to provide the access token for authorization (I have >> provided the map-id), In the link provided by you, it is mentioned that: >> >> As of Mapbox.js 2.0, a Mapbox API access token is also required. In your >> Angular app, set the access token with the following line: >> >> mapboxService.init({ accessToken: 'YOUR_ACCESS_TOKEN' }); >> >> If i inject mapboxservice in the child controller, the other part of the >> controller is not working and the resultant html page is not loading >> properly. Please suggest me where to use the access token properly. >> >> Regards, >> Prudhvi. >> >> >> On Thursday, October 8, 2015 at 3:07:15 PM UTC+5:30, plitzenberger wrote: >> Ah, I see. The ‘angular-mapbox’ is a module. U can’t inject this in your >> controller. Remove it from injectParams and just use the directive >> <http://inkblot.io/angular-mapbox/> “mapbox” in your view. >> >> <mapbox map-id="YOUR-MAP-ID" lat="47.603569" lng="-122.329453"></mapbox> >> >> Best, Philipp >> >>> On 08 Oct 2015, at 10:57, Prudvi Seshu <prudvi...@ <>gmail.com >>> <http://gmail.com/>> wrote: >>> >>> Hi philipp, >>> >>> Thank you very much for the reply. If I use 'angular-mapbox' in the >>> controller function, I am getting the error: >>> >>> Uncaught SyntaxError: Unexpected token - >>> >>> I am actually referring to: https://github.com/licyeus/angular-mapbox >>> <https://github.com/licyeus/angular-mapbox> for mapbox integration to my >>> website, I think i have to use mapboxService in the controller function. >>> But it is not working properly. Any other ideas please... >>> My only concern is to integrate mapbox map in html page using angular js. >>> >>> Regards, >>> Prudhvi. >>> On Thursday, October 8, 2015 at 12:41:14 PM UTC+5:30, plitzenberger wrote: >>> Hi Prudhvi, >>> >>> The ‘angular-mapbox’ is missing in the controller function. >>> >>> >>> >>> Regards, >>> Philipp >>> >>> >>>> On 08 Oct 2015, at 06:38, Prudvi Seshu <prudvi...@ <>gmail.com >>>> <http://gmail.com/>> wrote: >>>> >>>> Hi Sander Elias, >>>> >>>> Many thanks for the reply. Yes I have injected angular-mapbox directive >>>> into the main app.js file like this: >>>> >>>> >>>> >>>> var app = angular.module(sakeetApp, ['ngRoute', >>>> 'ngCookies','ngStorage','angular-mapbox','angularFileUpload']); >>>> >>>> app.config(['$routeProvider', '$locationProvider', '$httpProvider', >>>> >>>> function ($routeProvider, $locationProvider, $httpProvider) { >>>> >>>> >>>> >>>> In child controller (AdminController.js): >>>> >>>> 'use strict'; >>>> >>>> >>>> >>>> (function () { >>>> >>>> var injectParams = >>>> ['$scope','$rootScope','$location','$route','$localStorage','$window','$cookieStore', >>>> >>>> 'ConfigService', 'UserService','CategoryService','angular-mapbox', >>>> 'FeedService','NotifyService']; >>>> >>>> var controller = function ($scope,$rootScope, >>>> $location,$route,$localStorage,$window,$cookieStore, >>>> >>>> ConfigService, UserService, >>>> CategoryService,FeedService, NotifyService) { >>>> >>>> >>>> After injecting into Admincontroller.js, i am getting the error. I have >>>> included the 1.mapbox.js, 2. angular-mapbox.js files in index.html file. >>>> But still the error persist. >>>> >>>> >>>> On Thursday, October 8, 2015 at 9:45:07 AM UTC+5:30, Sander Elias wrote: >>>> Hi Prudhvi, >>>> >>>> Did you inject your mapbox into your application? >>>> >>>> Regards >>>> Sander >>>> >>>> -- >>>> 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 angular+u...@ <>googlegroups.com <http://googlegroups.com/>. >>>> To post to this group, send email to ang...@ <>googlegroups.com >>>> <http://googlegroups.com/>. >>>> Visit this group at http://groups.google.com/group/angular >>>> <http://groups.google.com/group/angular>. >>>> For more options, visit https://groups.google.com/d/optout >>>> <https://groups.google.com/d/optout>. >>> >>> >>> -- >>> 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 >>> <http://groups.google.com/group/angular>. >>> For more options, visit https://groups.google.com/d/optout >>> <https://groups.google.com/d/optout>. >> >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] <javascript:>. >> Visit this group at http://groups.google.com/group/angular >> <http://groups.google.com/group/angular>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > 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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/angular > <http://groups.google.com/group/angular>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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.
