html - how to pass values from child pop up window to parent page using angular js -
i have parent page in through 1 link pop window appears , want pass input values parent page when ok button pressed. have used service store value think service methods called when page loads , since have pass value child parent page not loaded again values not persisting. can please me out in this.
this parent page :
<!-- here want show values got child. in tree-data="domain" not getting values pass child html --> <swt-tree tree-data="domain" tree-control="statementtree" label-provider="domainlabelprovider" content-provider="domaincontentprovider" expand-level="-1"> </swt-tree> <!-- here child html load --> <div ui-view></div>
this child.html
<form ng-controller="domaincontroller"> <input type="text" ng-model="busdomain.name" ng-change="namechanged()"> <!-- here in tree-data="statements" getting values passed child.html --> <swt-tree tree-data="statements" on-select="statementselected(branch, selected_branches)" tree-control="statementtree" label-provider="domainlabelprovider" content-provider="domaincontentprovider" expand-level="-1"></swt-tree> <button type="submit" ng-click="addsubtree(createdomain.$valid)">ok</button> </form>
this controller.js
controller('domaincontroller', ['$scope', '$state', 'domainnameservice', function($scope, $state, domainnameservice) { $scope.activetab = 1; $scope.statements=[]; var statementtree = {}; $scope.statementtree = statementtree = {}; $scope.domain = domainnameservice.getdomainname(); $scope.addsubtree = function(val){ var vartype = "busdomain"; var domain=[]; var busdomain=$scope.busdomain.name; var parent = domainnameservice.getdomainname()[0]; $scope.currentdomainname=$scope.getbusdomain(busdomain,parent,vartype); $scope.statements.push($scope.currentdomainname); $scope.statementtree.setnewinput($scope.statements); domainnameservice.addbusdomain($scope.busdomain.name); $scope.domain.domainname = domainnameservice.getbusdomainname[0]; //i passing values here service later on values resets previous value..i don't know how persist values in $scope.domain.domainname $state.go('domaintree'); } $scope.getbusdomain = function(sttype,parent,vartype) { return {node:[{name:parent}],name:parent, child:[{name:sttype,reftype: vartype}], childnode:sttype, reftype: vartype}; }
this service.js
app.factory('domainnameservice', function() { var busdomainvalue=[]; var busdomain = undefined; return{ addbusdomain: function(busdomname){ busdomainvalue.push(busdomname); }, getbusdomainname: function(){ return busdomainvalue; } } })
please 1 me out in resolving issue. in advance.
Comments
Post a Comment