Angular's Components and Directives: A Comprehensive Guide

My goal is to render a subview within a template and define the state inside the subview's controller when an element is clicked. I am separating it from the main controller because there will be further subviews within this initial subview.

However, upon trying to implement this, I encounter the following error:

Error: [$injector:modulerr] Failed to instantiate module ivy.quote.controllers.durationCtrl due to: TypeError: Cannot read property 'navigable' of undefined

This error occurs before clicking the button that should trigger the following transition:

$state.transitionTo('quote.duration');

quote.tpl.html

<div class="quote grid" disable-scroll>
  <div modal-from-bottom modal-hidden="calendarHide"
    modal-content-class="quote__keypad" modal-speed="200" ui-view></div>
</div>

quoteCtrl.js

angular.module('ivy.quote.controllers.quoteCtrl', [
    'ivy.quote.controllers.keypadCtrl',
    'ivy.quote.controllers.durationCtrl',
    'ivy.quote.services.quoteManager',
    'ui.router',
    'ivy.quote.calendar',
    'wn.keypad',
    'wn.gesture.disableScroll'
  ])

/**
 * Configure UI Router
 */
  .config(['$stateProvider', function ($stateProvider) {
    $stateProvider.state('quote', {
      url: '/quote',
      controller: 'quoteCtrl',
      templateUrl: 'quote/templates/quote.tpl.html'
    });
  }])

  .controller('quoteCtrl', ['$scope', '$timeout', '$state', 'quoteManager',
    function ($scope, $timeout, $state, quoteManager) {
}]);

duration.tpl.html

<div class="quote__calendar">
  <h2>DURATION</h2>
  <div ui-view></div>
</div>

durationCtrl.js

angular.module('ivy.quote.controllers.durationCtrl', [
  'ui.router'
])

 .config(['$stateProvider', function ($stateProvider) {
  $stateProvider.state('quote.duration', {
    url: '/duration',
    controler: 'durationCtrl',
    templateUrl: 'quote/templates/duration.tpl.html'
  });
}])

 .controller('durationCtrl', ['$scope', function ($scope) {
  console.log('durationCtrl', $scope);
}]);

Answer №1

Make sure to use "controller" instead of "controler". Other than that, the setup appears to follow the standard format seen in most subviews tutorials.

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

Experiencing a WEB3js error in a Vite, React, TypeScript application: Troubleshooting TypeError with callbackify function absence

Hey there, I've been experimenting with using web3 in a React client application (specifically with vite react-ts). When trying to call web3.eth.net.getId(), I encountered an error mentioning that callbackify is not a function. After some investigatio ...

Troubleshooting npm audit error involving loadVirtual and ENOLOCK

➜ npm safety check npm ERR! code ENOLOCK npm ERR! safety check This operation requires an existing lockfile. npm ERR! safety check Please generate one using: npm i --package-lock-only npm ERR! safety check Original error: loadVirtual needs a preexistin ...

Guide on displaying a JSON file from a separate port in Symfony2

Just diving into symfony2 and encountering a little challenge here. I've got my localhost all set up using wamp server with some port assignments: Port 80 (default) for symfony: mylocal/app_dev.php/test Port 8080 for the public folder: mylocal:8080/cs ...

Combining the power of Kendo UI with the flexibility of Vue

Hey there everyone, I'm currently utilizing the Vue.js CLI for my project. Recently, I came across a helpful tutorial on incorporating a Jquery plugin into a webpack project at this link: . To achieve this, I installed the expose loader and added th ...

Guide to integrating a static page with personalized CSS and JavaScript resources within a Rails project

Currently, I am developing a simple Rails application (using Rails version 4.1) and I am looking to incorporate a static page into it. The static page is structured as follows: | |- index.html |- css folder |-- (various css files) |- js folder |-- (some j ...

Is there a way to extract a token from the URL in a Nextjs/React application?

I am currently developing a project that relies heavily on API integration. My front-end interface is built using React and Next.js, while the back-end API is developed with Laravel. Within my front-end page, I have implemented a token in the URL to help ...

Establish map boundaries using the longitude and latitude of multiple markers

Utilizing Vue, I have integrated the vue-mapbox component from this location: I've made sure to update the js and css to the latest versions and added them to the index.html: <!-- Mapbox GL CSS --> <link href="https://api.tiles.mapbox.com/m ...

Node.js MySQL REST API query fails to execute

I am developing a login/sign up API using nodejs, express, and mysql. Despite receiving the "Successful Sign Up!" message without any errors during testing, the user table in the database remains empty. Below is the query I am attempting to execute: con. ...

Colorbox scalePhotos function malfunctioning

The scalePhotos option in Colorbox does not seem to be working correctly for me. I have tried various methods to set it, including initializing Colorbox using the following code snippet right before the closing </body> tag in my HTML: jQuery('a ...

Secure an input field for exclusive attention. React

How can I lock the focus of my input field? I attempted using the following code: onBlur={this.click()} However, it was not successful. What is the correct way to accomplish this? ...

Utilizing clip-path polygons for effective styling on Firefox and iOS

I have been working on a plugin to create animated modal boxes by utilizing the clip-path property. However, I have encountered an issue where this code only seems to work in Chrome. You can view the codepen demo here. Unfortunately, it appears that Firef ...

Simulated alternate identities for UI Router

I am managing a group of pages/URLs that share a common parent state/template: /orders/list /orders/create /products/list /products/create Currently, I have two dummy states/routes (/products and /orders) that serve as parent states for the other substat ...

Model updating with the addition of an item and triggering a secondary ng-repeat for refreshing

As I was working on the phone tutorial, I found myself pondering how to implement a specific use case. The browser renders a list of phones. When the user clicks on add phone for one of these phones, the function addItem is triggered and adds that phone ...

The server appears to be up and running, however there seems to be an issue when attempting to access the API as it is returning an Error: connect ECONNREFUSED 127.0.0.1

Trying to decouple app and server. Successfully running, but encountering Error: connect ECONNREFUSED 127.0.0.1:3000 in Postman when hitting "app.get('/')" API despite making necessary changes. In ./routes/users.js const express = requ ...

Is there a new update to Google Maps API?

After successfully building a map component for a web application using google maps, open layers, and the dojo toolkit, it suddenly stopped loading earlier this morning. Even though there are no JavaScript errors and open layers and Google still initialize ...

What could be causing my default prop to not be transmitted to the child component in vuejs2?

Having trouble passing a default value to my Leaflet map child component before fetching the desired data from an API endpoint. I tried using country coordinates like latitude and longitude, but it's not working as expected. This is how I attempted t ...

Is it possible for PHP to return jQuery code and have it execute immediately upon being echoed?

As someone who is new to jQuery and PHP, I have been tasked by my boss to create a login system for a web page that contains sensitive company information. The challenge is that this webpage consists of just one html/php file. Here is what I have done so ...

Content briefly appears and then vanishes with the use of ng-if

On my webpage, I have content that is enclosed in an ng-if directive as shown below: <div ng-if="ShowMessgae" class="text-danger"> <p> <strong> Message displayed to User </strong> </p> < ...

Showing skeleton placeholders while waiting for the completion of an Array map function in React

I am currently working on a country list component that includes phone codes, country names, and flags. The use of the map() function is causing some delay in loading time. I am looking for a way to determine if the map() function has finished executing or ...

Submitting incomplete values from a Jquery form to a MySQL database

I'm having an issue with my IntelXDK HTML5 mobile app where the form is submitting empty values to the MySQL database. Here is the HTML code for my single file app: <label class="item item-input widget uib_w_6 d-margins" data-uib="ionic/input" da ...