angularjs kendo ui tabstrip动态标签

时间:2016-05-08 16:20:54

标签: angularjs kendo-tabstrip

在我的主页面中,我有一个tabtrip,它的标签项是动态加载的。但angularjs不会为tabitem加载相关的控制器。

我的代码是这样的:

var tabStripElement = $("#tabstrip").kendoTabStrip({
animation: {
    open: {
        effects: "fade"
    }
},
dataTextField: 'text',
dataContentField: 'content',
dataImageUrlField: 'dataImageUrl',
dataUrlField: 'url',
dataContentUrlField: 'contentUrl',
});
tabStripElement.parent().attr("id", "tabstrip-parent");
var tabStrip = tabStripElement.data("kendoTabStrip");


angular.module('myApp', []).controller('MainController', ['$scope', function($scope){
 $scope.openTab()
 {
    tabStrip.append({
    text: 'Title',
    contentUrl: '/tabItem.html',
     encoded: false
    });
   }
}])
.controller('TabController', ['$scope', function($scope){
 }])

的MainPage:

<html ng-app="myApp">
   <head>
     <meta charset="utf-8">
     <link href="~/Content/kendo/2016.1/kendo.common.min.css" rel="stylesheet" />
     <link href="~/Content/kendo/2016.1/kendo.default.min.css" rel="stylesheet" />
  </head>
 <body ng-controller="MainController">
    <div  id="tabstrip" class="text-right">
    </div>
   <script src="~/Scripts/lib/jquery/jquery-1.12.0.js"></script>
   <script src="~/Scripts/lib/angular/angular.js"></script>
   <script src="~/Scripts/lib/angular/angular-resource.js"></script>
   <script src="~/Scripts/lib/kendo/2016.1/kendo.all.min.js"></script>
   <script src="~/Scripts/js/app.js"></script>
   <script src="~/Scripts/js/controllers.js"></script>
  </body>
 </html>

和标签的视图是这样的:

<div ng-controller="TabController">
   <input type="text" />
</div>

0 个答案:

没有答案