需要在单个页面上使用两个视图,在角度js中使用单独的模块

时间:2016-02-16 04:24:14

标签: javascript angularjs

$VAR1 = {
          'width' => 45,
          'file_media_type' => 'image/png',
          'file_ext' => 'png',
          'PNG_Chunks' => [
                            'IHDR',
                            'gAMA',
                            'cHRM',
                            'IDAT',
                            'IEND'
                          ],
          'Chunk-cHRM' => '  z%  Çâ  ·   ÇF  u0  O`  :ù  ?o',
          'PNG_Filter' => 'Adaptive',
          'color_type' => 'RGB',
          'height' => 20,
          'Gamma' => '0.45454',
          'resolution' => '1/1',
          'SampleFormat' => 'U8',
          'Compression' => 'Deflate'
        };

2 个答案:

答案 0 :(得分:0)



       
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
</head>
<body>
    <div id="App1" ng-app="myApp1" ng-controller="MyControllerA">
        <h1>My Name</h1>
        <div >
            <span>{{name}}</span>
            
        </div>
    </div>

    <div id="App2" ng-app="myApp2" ng-controller="MyControllerB">
        <h1>My Surname</h1>
        <div >
            <p>{{name}}</p>
        </div>
    </div>
    <script>
            angular.module("myApp1", [])
            .controller("MyControllerA",
                function($scope) {
                    $scope.name="sagar";
                   
                }
            );
            angular.module("myApp2", [])
            .controller("MyControllerB",
                function($scope) {
                    $scope.name = "chopada";
                }
            );
            angular.bootstrap(document.getElementById("App2"),['myApp2']);
    </script>
</body>
</html>
&#13;
&#13;
&#13;

希望它会帮助你......

答案 1 :(得分:0)

您需要手动引导Angular应用程序,如下所示。查看链接:https://plnkr.co/edit/iW8GzBgexjylXiq1IWtp?p=preview

  <typeAlias alias="ISignatureCalculation" type="Diagnostics.Report.Repository.Contract.ISignatureCalculation, Diagnostics.Report.Repository.Contract" />
  <typeAlias alias="SignatureCalculationDefault" type="Diagnostics.Report.Signature.SignatureCalculation, Diagnostics.Report.Signature" />
  <typeAlias alias="SignatureCalculationBGL" type="Diagnostics.Report.Signature.BGL.SignatureCalculation, Diagnostics.Report.Signature.BGL" />
  <typeAlias alias="SignatureCalculationPrototyp" type="ErrorReportAnalyzer.SignatureCalculator, ErrorReportAnalyzer" />
  <typeAlias alias="SignatureCalculationRefactored" type="ExceptionBasedAndReferencesMappingAlgorithm.SignatureCalculator, ExceptionBasedAndReferencesMappingAlgorithm" />

  <typeAlias alias="IDataStore" type="Diagnostics.Report.Repository.Contract.IDataStore, Diagnostics.Report.Repository.Contract" />
  <typeAlias alias="DataStoreDefault" type="Diagnostics.Report.Repository.SqlDb.SqlDataManager, Diagnostics.Report.Repository.SqlDb" />
</typeAliases>
  <container>
  <types>
     <type type="IReportDecoding" mapTo="ReportDecodingDefault"></type>
    <type type="ISignatureCalculation" mapTo="SignatureCalculationRefactored"></type>
    <type type="IDataStore" mapTo="DataStoreDefault"></type>
  </types>
    </container>
</unity>