Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p>Current url = {{url}}</p>
- app.controller('MainController', function($scope) {
- // This is the inital url
- // It shows up in the HTML fragment
- $scope.url = "http://stackoverflow.com";
- });
- webview.addEventListener('loadcommit', function() {
- url = webview.src;
- //How to update Angular framework with current value of url?
- }
- $scope.url = url;
- <div ng-controller="MainController">
- <webview current-src="url" id="foo"
- src="http://stackoverflow.com/"
- style="width:640px; height:480px">
- </webview>
- <p>Current url = {{url}}</p>
- </div>
- app.directive("webview",function() {
- return {
- restrict: "E",
- link: function(scope,elem,attrs) {
- var webview=elem[0];
- elem.on("loadcommit", function(e) {
- $scope.$apply(attrs.currentSrc +'='+ webview.src);
- };
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement