1

I have the following code and I want to render my partial file inside a tab.

In my service.html

<html ng-app="ui.bootstrap.demo">
  <head>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
    <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.js"></script>
    <script src="app.js"></script>
    <script src="example.js"></script>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>

<div ng-controller="TabsDemoCtrl">


  <tabset>
    <tab heading="Justified"><div ng-include src="sunday.html"></div></tab>
    <tab heading="SJ"><div ng-include src="monday.html"></div></tab>
    <tab heading="Long Justified">Long Labeled Justified content</tab>
  </tabset>
</div>
  </body>
</html>

and in my app.js i hv the following code

angular
  .module('letsSchedulecommyApp', [
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ui.bootstrap',
    'ui.calendar',
    'ngSanitize',
    'ui.router'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/cleaning_services/homepage.html',
        controller: 'CleaningServicesCtrl'
      })
      .when('/maid-cleaners', {
        templateUrl: 'views/cleaning_services/maid_cleaning_service.html',
        controller: 'CleaningServicesCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });

  });

this is my plunkr file http://plnkr.co/edit/PgXGQFe8mDJ1lDkpEqrx

So basically, i want to click on the tab and then view the rendered partial file.

Any help appreciated.

1 Answer 1

2

ng-include src should be in ' single qoute, Add ng-view to get view angular $routing views on page.

HTML

<div ng-controller="TabsDemoCtrl">
  <tabset>
    <tab heading="Justified"><div ng-include src="'sunday.html'"></div></tab>
    <tab heading="SJ"><div ng-include src="'monday.html'"></div></tab>
    <tab heading="Long Justified">Long Labeled Justified content</tab>
  </tabset>
  <div ng-view>
  </div>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

Or put the source into a $scope var: $scope.urlSource = "sunday.html" - ng-include="urlSource" - either way, +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.