Exploring the integration of angular-ui-select into an angular seed project

I set up a new project using the starter template from https://github.com/angular/angular-seed and now I'm attempting to integrate angular-ui-select for dropdown menus. I've added select.js and select.css files to my index.html as well as installed Angular-sanitize.

This is how my view1.html file looks:

 <p>This is the partial for view 1.</p>
<ui-select ng-model="vm.person.selected" style="min-width: 300px;">
    <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
    <ui-select-choices repeat="person in vm.people">
      <div ng-bind-html="person.name | highlight: $select.search"></div>
      <small>
        email: {{person.email}}
        age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
      </small>
    </ui-select-choices>
  </ui-select>

And here's what my controller looks like:

'use strict';

angular.module('myApp.view1', ['ngRoute','myApp.testDirective', 'ngSanitize', 'ui.select'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/view1', {
    templateUrl: 'view1/view1.html',
    controller: 'View1Ctrl',
    controllerAs: 'vm'
  });
}])

.controller('View1Ctrl', [function() {
    var vm = this;
    vm.people = [
   { name: 'Adam',      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e68782878ba6838b878f8ac885898b">[email protected]</a>',      age: 10 },
   { name: 'Amalie',    email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="53323e323f3a3613363e323a3f7d303c3e">[email protected]</a>',    age: 12 },
   { name: 'Wladimir',  email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dcabb0bdb8b5b1b5ae9cb9b1bdb5b0f2bfb3b1">[email protected]</a>',  age: 30 },
   { name: 'Samantha',  email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="34475559555a405c55745159555d581a575b59">[email protected]</a>',  age: 31 },
   { name: 'Estefanía', email: 'estefaní<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e2f0e2b232f2722602d2123">[email protected]</a>', age: 16 },
   { name: 'Natasha',   email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="97f9f6e3f6e4fff6d7f2faf6fefbb9f4f8fa">[email protected]</a>',   age: 54 },
   { name: 'Nicole',    email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="89e7e0eae6e5ecc9ece4e8e0e5a7eae6e4">[email protected]</a>',    age: 43 },
   { name: 'Adrian',    email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9dfcf9eff4fcf3ddf8f0fcf4f1b3fef2f0">[email protected]</a>',    age: 21 }
 ];
}]);

This image shows the issue I'm facing with the display right now: https://i.sstatic.net/r2MxK.png

Answer №1

The root of the problem lies in a CSS issue, surprisingly enough. To resolve it, you must incorporate Bootstrap 3 into your code:

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.css">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the proper way to execute a JavaScript function within a JavaScript file from an HTML file?

I have the following content in an HTML file: <!DOCTYPE html> <!-- --> <html> <head> <script src="java_script.js"></script> <link rel="stylesheet" type="text/css" href="carousel.css"> & ...

Issue with Ajax/Json: "An object of type triggers a circular reference error when attempting to retrieve a list."

Recently, I encountered an issue with my server-side method that is triggered through JSON/Ajax. The method itself functions flawlessly and sends back a list as expected. However, I seem to have made an error in my JavaScript code, leading to the following ...

Show the total sum of a specific column in a datatable and enable the option to export the data to an Excel

When exporting a datatable as an Excel file with 4 columns, the third column contains product prices. After the export, I would like to see an additional row at the end of the table labeled "Total" that displays the sum of all values in column 3. I initia ...

Error: The selector "html" is not considered pure as it does not contain any local class or id. Pure selectors must include at least one local class or id

When working on my Next.js project, I included the following code in _app.js: import '../src/styles/style.module.scss'; import '../src/styles/main.module.scss'; This is the content of main.module.scss: // ./src/styles/main.module.scss ...

Dealing with errors in Smart Query using Nuxt and Vue Apollo: How to navigate to specific error pages for 404, 400, or 500 errors and is it possible to catch

When utilizing Smart Query for redirection, how can we redirect to a 400 page? While working with Vue Apollo, I attempted the following: apollo: { queryName: { prefetch: true, query: wrongQuery, error(e ...

What is the best way to apply styling to an image that is contained within the document.write function?

I'm looking to customize the design of this cat image, but I'm struggling to locate where to incorporate the div class. It's likely a basic step, but as a beginner in JavaScript, I'm hoping that someone can assist me. document.write(&ap ...

Tips for hiding a sidebar by clicking away from it in JavaScript

My angular application for small devices has a working sidebar toggling feature, but I want the sidebar to close or hide when clicking anywhere on the page (i.e body). .component.html <nav class="sidebar sidebar-offcanvas active" id="sid ...

Explore the wonders of Jest and Playwright by heading over to youtube.com and discovering an exciting video!

As part of my job responsibilities, I have been tasked with automating tests for a web application that our team developed. Using Playwright and Jest, I am required to write automation scripts from scratch. To practice utilizing Playwright, I decided to cr ...

Enhance your website with a dynamic jQuery gallery featuring stunning zoom-in

I am currently working on a mobile website project and I'm in need of a gallery feature that allows users to zoom in on images and swipe through them using touch gestures. After some research, I haven't been able to find a suitable solution in j ...

Bringing in two JavaScript files with identical names

Recently, I encountered a challenging situation. I am working with material-ui and nextjs, both of which have a module called Link that is essential for my project. import { Link } from '@material-ui/core'; However, this setup is causing compil ...

Challenges with Webpack sourcemaps

As I delve into learning nodejs and react, my current challenge lies in building bundle.js and debugging it within the browser. However, despite creating the bundle.map file, I am faced with errors as the webpack tab fails to appear in the browser. DevTool ...

Altering the "src" property of the <script> tag

Can the "src" attribute of a current <script> element be altered using Jquery.attr()? I believed it would be an easy method to enable JSONP functionality, however, I am encountering difficulties in making it operate effectively. ...

Exploring methods to send a JSON object through an Express response using Node.js

Is it possible to send a JSON object via express response using res.send? Currently, I am logging the data in the console using console.log(JSON.stringify(row)), but I would like to utilize res.send to display the data on my webpage. Here are the logs: ...

Symfony is unable to access uploaded files from an AngularJS interface

For the past 3 days, I've been grappling with uploading files via AJAX to my Symfony2 application using AngularJS. I'm utilizing my Symfony app as an API to deliver data to my Angular front end. While I can successfully post text and other data, ...

Change the height of textarea dynamically using jQuery

I am trying to create a comment box similar to Facebook's, where it resizes as text fills it using Expanding Text Areas Made Elegant This is how my view looks: <div class='expandingArea'> <pre><span></span></ ...

An issue encountered with getServerSideProps in NextJS 12 is causing a HttpError stating that cookies are not iterable, leading

Currently, I have an application running smoothly on my localhost. However, when it comes to production, an unexpected error has popped up: Error: HttpError: cookies is not iterable at handleError (/usr/src/.next/server/chunks/6830.js:163:11) at sendReques ...

ways to instantly showcase the input's value within a DIV element

For example, I have a div with the ID of "someDiv" and an input text field with the ID of "someInput". How can I make it so that the value entered into the input field displays in the DIV in real time? For instance, if I type the letter "a" in the input fi ...

Unable to access the token received as a cookie from Spring Boot in AngularJS

Although the cookie is visible in the browser, I am unable to access it using $cookie.get('io'). What could be causing this issue? I have even attempted using a $timeout with a 5-second delay. Upon inspecting the headers(), I noticed that the tok ...

There is no information stored in req.session.passport, and req.user is not defined

I've previously raised a similar issue, but it was under the Javascript category. I now have more specific insights into what might be causing the problem. The main issue is that req.session.passport appears empty in my logs. As I navigate through my ...

The FlatList component will only trigger a re-render once the list has been scrolled

I need help with updating a FlatList in my app. Currently, the list is populated by an array stored in the component's state and can be filtered using a filtering function that updates the state with a new filtered array. However, I have noticed that ...