Last active
August 29, 2015 13:56
-
-
Save congjf/9205024 to your computer and use it in GitHub Desktop.
AngularJS in Chrome Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call Chrome API | |
function MyController($scope){ | |
chrome.bookmarks.getTree(function(tree){ | |
// Here MUST use $scope.$apply() for Render the data updated to View. | |
$scope.$apply(function(){ | |
$scope.tree = tree[0].children; | |
}); | |
}); | |
} | |
// Call Chrome API with Event | |
function MyController($scope) { | |
$scope.showBookmarks = chrome.bookmarks.getTree(function(tree){ | |
$scope.tree = tree[0].children; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment