Start a new topic

Angular Bootstrap Issue

Hi There



I'm having trouble with the code snippet from the blog announcement on the Angular library (http://www.kinvey.com/blog/3541/kinvey-javascript-library-now-available-for-angularjs-web-apps).



The code I am using is:























The error is:

Method not implemented: Kinvey.Persistence.Net.encode



Any ideas?



Thanks

Paul


The response can be `null`, that’s perfectly valid and will occur when you are not logged in. You might also want to add a second callback to catch init failures:



```

$kinvey.init(...).then(function(response) {

// success.

angular.bootstrap(...);

}, function(error) {

// error.

});

```
Hi Mark.



The code you posted doesn't work for me either. I'm using the code you posted below, with a simple "app.js" that looks like this:



```

angular.module('MyApp')

.run(function ($kinvey) {

// $rootScope.build = '1.2';

console.log('i ran');

})

```



```

var jelly = angular.module('MyApp', ['kinvey']);

var $injector = angular.injector(['ng', 'kinvey']);

$injector.invoke(function($kinvey) {

$kinvey.init({

appKey : 'kid_TVxvWekpKi',

appSecret : '051f45d70e964e3a8a0cef8a9389e704'

}).then(function(response) {

console.log(response);

angular.bootstrap(document, ['MyApp']);

});

});

```



I get the "i ran", but the response from kinvey in the bootstrap is null.
Yes, I am able to reproduce, this is a bug. The code below will work correctly:



```

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



var $injector = angular.injector(['ng', 'kinvey']);

$injector.invoke(['$kinvey', function($kinvey) {

$kinvey.init({

appKey : 'App Key',

appSecret : 'App Secret'

}).then(function() {

angular.bootstrap(document, ['MyApp']);

});

}]);

```



Thanks for noticing!
Code didn't format - Example available at:

https://googledrive.com/host/0BzRWnhah7n0bZk9VZmpGOUJ4UFE/indexKinveyInit.html
Login or Signup to post a comment