AngularJS configure a child window (Directive not working) -


ok, have child window own app.js. first, best way handle child windows, separate out logic?

the issue have while controller in child works fine, directive not. have same directive defined in separate module parent, , works great.

child html:

<!doctype html> <html lang="en" data-ng-app="evidentia-child"> <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8">     <link type="text/css" rel="stylesheet" href="css/app.css"/>     <title>evidentia claims editor</title> </head> <body>        <div style='width:100%' data-ng-controller='minieditorcontroller'>         <textarea data-ng-model='data.editortext'                   data-on-keyup="handlekeyup"                   style='height:4em;width:24.5em;'>{{data.editortext}}</textarea>         <button type='button' style='float:right;margin-top:1.2em;'                  data-ng-disabled='data.disabled'                 data-ng-click='sendclaim();'>             <img src='img/add16x16.png' width='16'/></button>        </div>      <script type="text/javascript" src="lib/jquery-1.9.1/jquery.min.js"></script>     <script type="text/javascript" src="lib/jqueryui-1.10.3/jquery-ui.min.js"></script>     <script type="text/javascript" src="lib/angular/angular.min.js"></script>     <script type="text/javascript" src="js/controllers/minieditorcontroller.js"></script>     <script type="text/javascript" src="js/app-child.js"></script> </body> </html> 

app-child.js:

'use strict';  // declare app level module depends on filters, , services angular.module('evidentia-child', []) .directive('onkeyup', function() {     return function(scope, elm, attrs) {         //evaluate variable passed         //in case we're passing variable points         //to function we'll call each keyup         var keyupfn = scope.$eval(attrs.onkeyup);         elm.bind('keyup', function(evt) {             //$apply makes sure angular knows              //we're changing             scope.$apply(function() {                 keyupfn.call(scope, evt);             });         });     }; }) .controller('minieditorcontroller', ['$scope', minieditorcontroller]); 

controller:

function minieditorcontroller($scope) {  $scope.data = {};  $scope.data.disabled = true;   $scope.sendclaim = function() {     if ($scope.data.editortext.length > 0) {         window.opener.scope.$broadcast('newclaim', $scope.data.editortext);         $scope.data.editortext = '';     } };  $scope.handlekeyup = function($event) {     if ($scope.data.editortext.length > 0) {         $scope.data.disabled = false;     } else {         $scope.data.disabled = true;     }      if ($event.ctrlkey && $event.keycode === 13) {         $scope.sendclaim(id);     } }; 

}


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -