The Angular-UI-Router version 1.0.11 is cautioning against the use of a class instead of an ID in the jarvis.widget.js file, stating "Warning: It appears you are using a

I recently upgraded my Angular version from 1.4.12 to angular v1.6.6 while using SmartAdmin. After the update, I noticed that an alert started appearing every time I switched between states where JarvisWidget was used. The alert is specifically triggered by lines 319-325 of the uncompressed jarvis.widget.js JavaScript library.

/**
 * Force users to use an id (it’s needed for local storage).
 **/
if (!$(‘#’ + self.objId).length) {
    alert(‘It looks like you’re using a class instead of an ID, please avoid doing that!’);
}

How can I prevent this alert from showing on pages without JarvisWidgets without modifying the JarvisWidget library? What could be causing this alert to trigger in my case?

Answer №1

If you are looking for an alternative solution while transitioning to the new version of angular-ui-router#1.0.11, you can try the following approach:

// Instead of reverting back to angular-ui-router#0.3.2, consider using a different framework like ui-router or @uirouter/core.

// Update link function in directive within jarvisWidget.js

link: function(scope, element, attributes) {
  if(element.data('widget-color'))
    element.addClass('jarviswidget-color-' + element.data('widget-color'));

  element.find('.widget-body').prepend('<div class="jarviswidget-editbox"><input class="form-control" type="text"></div>');

  element.addClass('jarviswidget jarviswidget-sortable');
  $rootScope.$emit('jarvisWidgetAdded', {widget: element, id: attributes.id });
}

// Modify the body of the jarvisWidgetAdded listener function in widgetGrid.js:

var widget = widgetPackage.widget;
var widgetId = widgetPackage.id;
if (widgetIds.indexOf(widgetId) == -1) {
  widgetIds.push(widgetId);
  $timeout(function () {
    setupWidgets(element, widgetIds)
  }, 100);
}

Explore this alternative solution as it may provide a more effective way to handle the transition.

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

Updating the Background Image Based on Text Input in JavaScript

Struggling to utilize the text entered into a text input field as a background image URL. Ensuring it is valid is key. This snippet displays what has been attempted so far... CSS: body { margin: 0px; padding: 0px; border: 0px; } .bgimg { backgr ...

Discovering the presence of a value within nested arrays

let array = [["1", "2], ["3", "4"], ["5", "6"]] My goal is to check whether the digit "4" is present in the given array ...

Leveraging Angular's ng-repeat and ng-show allows for specific data extraction from JSON

Looking to showcase the title and description of three items from a carousel, with data sourced from a JSON file via a unique code. Wondering if utilizing ng-show to specify 'if this matches code01 then display the corresponding data for that item&apo ...

Troubleshooting the integration of Text Mask Library with Vue - issue: no export named 'default' available

I was able to implement the vanilla JavaScript version: var maskedInputController = vanillaTextMask.maskInput({ inputElement: document.querySelector('.myInput'), mask: [/\d/, /\d/, '/', /\d/, /\d/, '/ ...

Experiencing difficulty with implementing an Angular filter to search through a list

Currently, I am utilizing an angular filter to search through a list. The searching functionality using the filter works as expected. However, I have encountered an issue with a checkbox labeled 'Select All'. When I search through the list and on ...

Having trouble with Vue i18n and TypeScript: "The '$t' property is not recognized on the 'VueConstructor' type." Any suggestions on how to resolve this issue?

Within my project, some common functions are stored in separate .ts files. Is there a way to incorporate i18n in these cases? // for i18n import Vue from 'vue' declare module 'vue/types/vue' { interface VueConstructor { $t: an ...

Enhanced SSL connectivity features in Meteor version 1.8.1

My development server is running on localhost (Windows 10 Pro x64 build 1903) and will eventually be moved to the production environment (Galaxy). To enable authentication through Facebook or Google, HTTPS is required. I configured Nourharidy Meteor SSL on ...

Incapable of retrieving data from MongoDB due to a failure in fetching results using streams in Highland.js

I have recently started working with streams and I am experimenting with fetching data from my collection using reactive-superglue/highland.js (https://github.com/santillaner/reactive-superglue). var sg = require("reactive-superglue") var query = sg.mong ...

Maintaining the current zoom level while updating a timeseries in Apache Echarts

Is there a way to maintain the current data zoom when updating timeseries data on my chart? Every minute I update the data, but the zoom resets to 100 each time. Additionally, how can I modify the text color of the label for the data zoom? I have been unab ...

Nodemon causing crashes in basic HTML pages

Having trouble getting a basic index.html page to work with nodemon. index.html <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> </hea ...

Exploring the different routing options for Nuxt.js: Dynamic versus Basic Routing

Can anyone suggest the best way to set up routing in Next.js for only Home, Gallery, and Contact us? Should I use dynamic routing or just keep it basic? Any ideas on how to path them? I'm still learning, so I would appreciate some guidance. I've ...

The expiration period set in expireAfterSeconds doesn't seem to be functioning as expected in the time-to-live (ttl) configuration. Rows are

Can you please take a look at my code and provide some feedback? The issue I am facing is that the record is getting deleted without specifying the number of seconds. I have tried changing from createIndex to ensureIndex but it's still not working as ...

The PHP file is returning a 403 Forbidden error for specific requests

My PHP script is returning a 403-Access Forbidden error for some HTTP requests, while others are working fine. I am receiving a 403 error for the following request (via AJAX) POST http://example.com/api/interaction/practitioner HTTP/1.1 Host: example.co ...

The JSONP file can be successfully retrieved through an AJAX request in the console, however, the data does not display when attempting

Currently attempting to send an ajax request utilizing the following code snippet: $.ajax({ url: "http://mywebsite.com/blog/json", dataType: "jsonp", jsonpCallback: "jsonpCallback" }); function jsonpCallback(data) { console.log(data); } E ...

Discover the secrets to obtaining live website information using Google Script!

I am looking to retrieve the exchange rate data from a specific website. My understanding is that the website is dynamic (I'm still new to javascript) and the data is not easily accessible. Can anyone guide me on how to extract the exchange rates? For ...

Troubleshooting a Laravel method invoked in JavaScript using PhpStorm

I'm seeking some advice on how to debug a Laravel function mapped in a JavaScript function that is being called in an HTML page. $('#upload-avatar').fileapi({ url: '{{ route("user.avatar") }}', accept: 'image/*&a ...

Eslint was unexpectedly unable to detect any errors in the .ts files

After creating a SvelteKit project with npm create svelte@latest, I included some .ts files for a particular library. However, when running eslint ., it fails to detect any errors. The default eslint config generated from Svelte is as follows: .eslintrc. ...

What could be causing this excessive lag?

I've been developing a new website, but the "buttons" I'm using seem to be causing significant lag. I need help resolving this issue. You can view the website here: The problematic code snippet is shown below: <td> <a href="templi ...

Blank area located at the bottom of the document

I'm having trouble designing a webpage without a scroll bar because there isn't much content to display on the page. I've tried searching for solutions and following steps to fix the issue, but I haven't had any success. If anyone can a ...

Access Denied - NodeJS

Currently facing an issue with my MEAN stack application on AWS - Windows. I've set port 3000 for the Node server and IIS is using the default port 80. When trying to retrieve data using Angular via Node, I encounter an error while making a GET reque ...