Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the Angular Bootstrap accordion to work

I'm having no luck getting the accordion to work from this repo: https://github.com/angular-ui/bootstrap

Seems like the titles don't show up, and I don't know why.

The HTML:

<!doctype html>
<html ng-app="myApp">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Angular UI Test</title>
    <meta charset="utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" />
    <script src="https://raw.github.com/angular-ui/bootstrap/master/src/accordion/accordion.js"></script>
    <script src="app.js"></script>
    <style type="text/css">
        .wrap {width:960px;margin:0 auto;}
    </style>
</head>
<body>
    <div class="wrap" ng-controller="MyCtrl">
        <accordion>
            <accordion-group title="Title">This has a one word title.</accordion-group>
            <accordion-group title="Title2">This also has a one word title.</accordion-group>
            <accordion-group title="Title With Spaces">This has a title with spaces!</accordion-group>
        </accordion>
    </div>
</body>

The JS:

var myApp = angular.module('myApp',['ui.bootstrap.accordion']);

function MyCtrl($scope) {
}
like image 767
kmm Avatar asked Oct 06 '22 02:10

kmm


1 Answers

You need to put ' ' to wrap the title

Here are 3 different ways to set it

<accordion>
            <accordion-group title="title">This has a one word title.</accordion-group>
            <accordion-group title="Title2='Title 2' ">This also has a one word title.</accordion-group>
            <accordion-group title=" 'Title 3' ">This has a title with spaces!</accordion-group>
</accordion>

here is the working plunker

like image 143
maxisam Avatar answered Oct 10 '22 03:10

maxisam