{"action":"created","issue":{"url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/404","labels_url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/404/labels{/name}","comments_url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/404/comments","events_url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/404/events","html_url":"https://github.com/madebymany/sir-trevor-js/issues/404","id":115911753,"number":404,"title":"edit/ update data on an existing instance with agularjs","user":{"login":"ilgianfra","id":11957418,"avatar_url":"https://avatars.githubusercontent.com/u/11957418?v=3","gravatar_id":"","url":"https://api.github.com/users/ilgianfra","html_url":"https://github.com/ilgianfra","followers_url":"https://api.github.com/users/ilgianfra/followers","following_url":"https://api.github.com/users/ilgianfra/following{/other_user}","gists_url":"https://api.github.com/users/ilgianfra/gists{/gist_id}","starred_url":"https://api.github.com/users/ilgianfra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilgianfra/subscriptions","organizations_url":"https://api.github.com/users/ilgianfra/orgs","repos_url":"https://api.github.com/users/ilgianfra/repos","events_url":"https://api.github.com/users/ilgianfra/events{/privacy}","received_events_url":"https://api.github.com/users/ilgianfra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/madebymany/sir-trevor-js/labels/Question","name":"Question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-09T16:22:37Z","updated_at":"2015-11-10T23:42:08Z","closed_at":null,"body":"Hi,\r\n\r\nIn my controller angular I create the new instance of sirTrevor like this:\r\n\r\n```javascript\r\n  function initSirTrevor(){\r\n    editorSt = new SirTrevor.Editor(\r\n      {\r\n        el: $('.js-st-instance'),\r\n        blockTypes: ['Text', 'Image', 'Heading'],\r\n        required: ['Text']\r\n      }\r\n    );\r\n}\r\n```\r\nBut i call this function if there is no other instances created, so i check it:\r\n\r\n```javascript\r\n  if(SirTrevor.config.instances.length <= 0){\r\n    initSirTrevor();\r\n  }\r\n```\r\nLike this i can call always the first instance, but when I go in the edit page I get the first instance and i put my block because they are stored in my server.\r\n\r\n```javascript\r\n        var instance = SirTrevor.getInstance(0);\r\n\r\n        // create new blocks for the updated data\r\n        project._description.forEach(function(block) {\r\n          instance.mediator.trigger('block:create', block.type, block.data);\r\n        });\r\n```\r\nIn project._description i have my stored data, and in fact it works well. But at this point my html is just a normal text area without those blocks or even the + symbol. If I refresh the page it works.\r\n\r\nI hope I explained my issue clearly :)"},"comment":{"url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/comments/155603790","html_url":"https://github.com/madebymany/sir-trevor-js/issues/404#issuecomment-155603790","issue_url":"https://api.github.com/repos/madebymany/sir-trevor-js/issues/404","id":155603790,"user":{"login":"raffij","id":28570,"avatar_url":"https://avatars.githubusercontent.com/u/28570?v=3","gravatar_id":"","url":"https://api.github.com/users/raffij","html_url":"https://github.com/raffij","followers_url":"https://api.github.com/users/raffij/followers","following_url":"https://api.github.com/users/raffij/following{/other_user}","gists_url":"https://api.github.com/users/raffij/gists{/gist_id}","starred_url":"https://api.github.com/users/raffij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raffij/subscriptions","organizations_url":"https://api.github.com/users/raffij/orgs","repos_url":"https://api.github.com/users/raffij/repos","events_url":"https://api.github.com/users/raffij/events{/privacy}","received_events_url":"https://api.github.com/users/raffij/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T23:42:08Z","updated_at":"2015-11-10T23:42:08Z","body":"Proof of concept for you. https://github.com/raffij/sir-trevor-angular\r\n"}}