我正在使用带有codeigniter的 angularjs开发系统。 我想做什么:
希望你得到我的问题。
示例代码:
<div ng-repeat="user in allUsers">
Only displaying : {{user.user_id}}, It is OK.
<a title="Edit in new window" href='javascript:window.open(\"".base_url()."phpcontroller/loadingview/user_id \",\"User Edit\", \"width=\"+screen.width+\",height=\"+screen.height+\",fullscreen=yes,location=no\");' >Test edit</a>
</div>
请尽量提出建议和解决方案。如果您没有清楚地解决我的问题,请发表评论。感谢。
更新:对于stackoverflow上的任何问题,问题都不完全重复。
答案 0 :(得分:0)
如果你想以一种有角度的方式做到这一点,你可以做这样的事情
angular.module('myApp', [])
.controller('myController', ['$scope', '$window', function($scope,$window) {
$scope.openWindow = function(greeting) {
$window.open("http://www.google.com", "", "width=640, height=480");
};
}]);
HTML代码
<div ng-controller = "myController">
<a title="Edit in new window" ng-click="openWindow() >Test edit</a>
</div>
答案 1 :(得分:0)
In angular js you can do something like,
$scope.newWindow = function(value) {
$window.open("http://your_url/routing_path/?key=value", "");
};
where routing_path will be ur routing url and value is the part where you actually send your value.
In your script you can have like
var myApp = angular.module('myApp', []);
myApp.run(function($rootScope, $location, $http, $timeout) {
$rootScope.$on('$routeChangeStart', function(event, next) {
if (next.originalPath === 'your_routing_url') {
var value = next.params.key;
}
});
});
答案 2 :(得分:0)
您也可以使用
等Web存储对象 var myApp = angular.module('myApp', []);
myApp.factory('anyService', function($http, $location) {
return {
set: function(key,value) {
return localStorage.setItem(key,value);
},
get: function(key) {
return localStorage.getItem(key);
},
destroy: function(key) {
return localStorage.removeItem(key);
}
};
});
将服务注入任何地方并获取数据。