Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用PhantomJS创建PDF和HTML输出,并计算HTML和PDF输出中包含的角度指令_Angularjs_Pdf Generation_Phantomjs_Angular Directive_Angular Controller - Fatal编程技术网

Angularjs 使用PhantomJS创建PDF和HTML输出,并计算HTML和PDF输出中包含的角度指令

Angularjs 使用PhantomJS创建PDF和HTML输出,并计算HTML和PDF输出中包含的角度指令,angularjs,pdf-generation,phantomjs,angular-directive,angular-controller,Angularjs,Pdf Generation,Phantomjs,Angular Directive,Angular Controller,我试图在HTML中附加一个angular指令,以便PhantomJS创建HTML和PDF输出。 片段如下: 我试图附加角度指令的代码如下: function drawWidget(widgets) { for(var i = 0; i < widgets.length; i++) { var iDiv = document.createElement('div'); var att = document.createAttribute("data-ss-colspan")

我试图在HTML中附加一个angular指令,以便PhantomJS创建HTML和PDF输出。

片段如下:

我试图附加角度指令的代码如下:

function drawWidget(widgets) {
 for(var i = 0; i < widgets.length; i++) {
    var iDiv = document.createElement('div');
    var att = document.createAttribute("data-ss-colspan");
    iDiv.className = "widget_box";
    iDiv.id = "graphId" + i;
    iDiv.innerHTML = '<div class="col-md-12 col-sm-12 head_categories">\
                        <span>' + widgets[i]["widgetTitle"] + '</span>\
                        <span class="pull-right menu_categori"></span>\
                     </div>\
                     <div style="clear:both;"></div>';
    att.value = widgets[i]["widgetSize"].toString();                                        // Set the value of the class attribute
    iDiv.setAttributeNode(att); 
    document.getElementById('widget_container').appendChild(iDiv);
    //var chartDiv = document.createElement('editor');
       document.getElementById(iDiv.id).append(angular.element('#widget_container').
                    scope().getChartElement(widgets, i));
 }
}
angular.module('app',[]).directive("editor", function(){
  return {
    require: "?ngModel",
    scope: true,
    controller: 'ChartController',
    template: "<input ng-model='value' ng-change='onChange()'>",
    link: function(scope, element, attrs, ngModel) {
        if (!ngModel) return;
        scope.onChange = function(){
            ngModel.$setViewValue(scope.value);
        };

        ngModel.$render = function(){
            scope.value = ngModel.$modelValue;
        };
    }
};
});
(function(){

'use strict'

angular.module('app').controller('ChartController', chartController);

chartController.$inject = ['$scope', '$compile'];

function chartController($scope, $compile) {

    $scope.getChartElement = function(widgets, i) {
        $scope.id = "graphId" + i;
        $scope.data = widgets[i]["chart_data"]["data"];

        /*var elementString ='<line-graph graph-id="id" graph-data="data" ' + ' width="' + widgets[i]["chart_data"]["divWidth"] + '" height="' + widgets[i]["chart_height"] +
             '" colors="' + widgets[i]["chart_data"]["colors"] + 
             '" interval="' + widgets[i]["chart_data"]["interval"] + '"></line-graph>';*/
        var elementString ='<editor ng-model="abc" minlength="3"></editor>';
        console.log("Element String : " + elementString);
        return elementString;
    };
};


})();
函数绘图小部件(小部件){
对于(var i=0;i
我的角度指令如下所示:

function drawWidget(widgets) {
 for(var i = 0; i < widgets.length; i++) {
    var iDiv = document.createElement('div');
    var att = document.createAttribute("data-ss-colspan");
    iDiv.className = "widget_box";
    iDiv.id = "graphId" + i;
    iDiv.innerHTML = '<div class="col-md-12 col-sm-12 head_categories">\
                        <span>' + widgets[i]["widgetTitle"] + '</span>\
                        <span class="pull-right menu_categori"></span>\
                     </div>\
                     <div style="clear:both;"></div>';
    att.value = widgets[i]["widgetSize"].toString();                                        // Set the value of the class attribute
    iDiv.setAttributeNode(att); 
    document.getElementById('widget_container').appendChild(iDiv);
    //var chartDiv = document.createElement('editor');
       document.getElementById(iDiv.id).append(angular.element('#widget_container').
                    scope().getChartElement(widgets, i));
 }
}
angular.module('app',[]).directive("editor", function(){
  return {
    require: "?ngModel",
    scope: true,
    controller: 'ChartController',
    template: "<input ng-model='value' ng-change='onChange()'>",
    link: function(scope, element, attrs, ngModel) {
        if (!ngModel) return;
        scope.onChange = function(){
            ngModel.$setViewValue(scope.value);
        };

        ngModel.$render = function(){
            scope.value = ngModel.$modelValue;
        };
    }
};
});
(function(){

'use strict'

angular.module('app').controller('ChartController', chartController);

chartController.$inject = ['$scope', '$compile'];

function chartController($scope, $compile) {

    $scope.getChartElement = function(widgets, i) {
        $scope.id = "graphId" + i;
        $scope.data = widgets[i]["chart_data"]["data"];

        /*var elementString ='<line-graph graph-id="id" graph-data="data" ' + ' width="' + widgets[i]["chart_data"]["divWidth"] + '" height="' + widgets[i]["chart_height"] +
             '" colors="' + widgets[i]["chart_data"]["colors"] + 
             '" interval="' + widgets[i]["chart_data"]["interval"] + '"></line-graph>';*/
        var elementString ='<editor ng-model="abc" minlength="3"></editor>';
        console.log("Element String : " + elementString);
        return elementString;
    };
};


})();
angular.module('app',[])指令(“编辑器”,函数(){
返回{
要求:“?ngModel”,
范围:正确,
控制器:“ChartController”,
模板:“”,
链接:功能(范围、元素、属性、模型){
如果(!ngModel)返回;
scope.onChange=函数(){
ngModel.$setViewValue(scope.value);
};
ngModel.$render=function(){
scope.value=ngModel.$modelValue;
};
}
};
});
获取图表元素代码如下:

function drawWidget(widgets) {
 for(var i = 0; i < widgets.length; i++) {
    var iDiv = document.createElement('div');
    var att = document.createAttribute("data-ss-colspan");
    iDiv.className = "widget_box";
    iDiv.id = "graphId" + i;
    iDiv.innerHTML = '<div class="col-md-12 col-sm-12 head_categories">\
                        <span>' + widgets[i]["widgetTitle"] + '</span>\
                        <span class="pull-right menu_categori"></span>\
                     </div>\
                     <div style="clear:both;"></div>';
    att.value = widgets[i]["widgetSize"].toString();                                        // Set the value of the class attribute
    iDiv.setAttributeNode(att); 
    document.getElementById('widget_container').appendChild(iDiv);
    //var chartDiv = document.createElement('editor');
       document.getElementById(iDiv.id).append(angular.element('#widget_container').
                    scope().getChartElement(widgets, i));
 }
}
angular.module('app',[]).directive("editor", function(){
  return {
    require: "?ngModel",
    scope: true,
    controller: 'ChartController',
    template: "<input ng-model='value' ng-change='onChange()'>",
    link: function(scope, element, attrs, ngModel) {
        if (!ngModel) return;
        scope.onChange = function(){
            ngModel.$setViewValue(scope.value);
        };

        ngModel.$render = function(){
            scope.value = ngModel.$modelValue;
        };
    }
};
});
(function(){

'use strict'

angular.module('app').controller('ChartController', chartController);

chartController.$inject = ['$scope', '$compile'];

function chartController($scope, $compile) {

    $scope.getChartElement = function(widgets, i) {
        $scope.id = "graphId" + i;
        $scope.data = widgets[i]["chart_data"]["data"];

        /*var elementString ='<line-graph graph-id="id" graph-data="data" ' + ' width="' + widgets[i]["chart_data"]["divWidth"] + '" height="' + widgets[i]["chart_height"] +
             '" colors="' + widgets[i]["chart_data"]["colors"] + 
             '" interval="' + widgets[i]["chart_data"]["interval"] + '"></line-graph>';*/
        var elementString ='<editor ng-model="abc" minlength="3"></editor>';
        console.log("Element String : " + elementString);
        return elementString;
    };
};


})();
(函数(){
“严格使用”
角度。模块('app')。控制器('ChartController',ChartController);
chartController.$inject=['$scope','$compile'];
函数chartController($scope,$compile){
$scope.getChartElement=函数(小部件,i){
$scope.id=“graphId”+i;
$scope.data=widgets[i][“图表数据”][“数据”];
/*var elementString=''*/
var elementString='';
log(“元素字符串:”+elementString);
返回元素字符串;
};
};
})();

对不起,出了什么问题?对不起,出了什么问题?