Open j-mcnally opened 9 years ago
So my issue is in the documentation it lists an old js / css version.
Inside controller would work
For those reading this, you need to inject the mapboxService like so:
angular.module('starter', ['angular-mapbox']).run(function(mapboxService){
mapboxService.init({ accessToken: 'YOUR_API_KEY' });
})
Hi @joelkinzel . I tried adding this code to my index.html file:-
The screenshot contains the header response of the network calls which shows that the map isn't displayed because of a 401(Unauthorized) error.
How ti fix this?
@tinker20 - This should go inside your Angular controller file.
Hi Joel,
I have tried adding this to the controller. Still the request is unauthorized.
angular.module('starter', ['angular-mapbox']).run(function(mapboxService){ mapboxService.init({ accessToken: 'ACCESS_TOKEN' }); }) app.controller('MenuCtrl', ['$scope', '$http','$stamplay' ,'userStatus','storefront', 'globalVariable', 'qId', function MenuCtrl($scope, $http, $stamplay, userStatus, storefront, globalVariable, paramValue) {
//Call service
//if user was defined -> update $scope
var user = userStatus.getUserModel()
user.currentUser().then(function(){
if(user.isLogged()){
$scope.user = {};
$scope.user.logged = true;
$scope.user.displayName = user.instance.displayName;
$scope.user.picture = user.instance.profileImg;
$scope.user._id = user.instance._id;
userStatus.setUser(user.instance.displayName,
user.instance.profileImg, user.instance._id, user.instance.email, true) getStorefront(paramValue, false) }else{ getStorefront(paramValue, true) } }, function(){ getStorefront(paramValue, true) })
Any help with that?
Thanks
On Fri, Sep 11, 2015 at 5:20 PM, joelkinzel notifications@github.com wrote:
@tinker20 https://github.com/tinker20 - This should go inside your Angular controller file.
— Reply to this email directly or view it on GitHub https://github.com/licyeus/angular-mapbox/issues/27#issuecomment-139526430 .
I've added
mapboxService.init({ accessToken: 'YOUR_ACCESS_TOKEN' });
a few times, but its not being used when requesting tiles.
I've tried it in my run and config. Where do I put it?