AngularJS | handle routing before they load

Issue I wish to create a simple authentication check for my routes by external service. I define the access requirements on the route object: $routeProvider .when(‘/’, { templateUrl: ‘src/app/views/index.html’, controller: ‘indexCtrl’, authenticated: true }) .when(‘/login’, { templateUrl: ‘src/app/views/login.html’, controller: ‘loginCtrl’,

Continue reading

angular: ng-class in ng-repeater , duplicate call

Issue first of all sorry for my English. my problem is: i’ve this simple code: <li ng:repeat=”item in menu.items” ng:class=”getMenuItemClass(item)”> <a ng:href=”#{{item.url}}”>{{item.label}}</a> </li> and this my getMenuItemClass: scope.getMenuItemClass = function(item) { console.log(item) var hashPath = $location.hashPath || ‘/’; if (hashPath

Continue reading

ng-class messing with the order of classes

Issue I have some very simple Angular code which looks like this… <div ng-repeat=”message in data.messages” ng-class=”‘conversationCard-‘ + message.type”></div> It works, but the resulting output looks like this…. <div ng-repeat=”message in data.messages” ng-class=”‘conversationCard-‘ + message.type” class=”ng-scope conversationCard-phone”></div> The problem is

Continue reading

How to change the color of the div based on a value

Issue Here are the scripts and style that I used: <script src=”angular.min.js”></script> <style> .greater { color:#D7E3BF; background-color:#D7E3BF; } .less { color:#E5B9B5; background-color:#E5B9B5; } </style> <script> var app = angular.module(‘MyTutorialApp’, []); app.controller(“controller”, function ($scope) { $scope.chargeability = [{ date: ’15-Sep-13′, max:

Continue reading

ng-class is not applied

Issue I am trying to validate a form using AngularJS. This is my form: <form ng-controller=”LoginCtrl” role=”form” class=”form-horizontal”> <div class=”form-group”> <label for=”email” class=”col-sm-2 control-label”>Email</label> <div class=”col-sm-10″> <input required type=”email” name=”email” ng-model=”email” class=”form-control” ng-class=”{ error: email.$invalid }” id=”email”> </div> </div> </form>

Continue reading

Angular apply class in directive

Issue I have a angular directive which will produce bootstrap form-group, looks for $scope.errors for value of ng-model of the directive to show errors.. Example below: My html code: <input type=”text” b-input ng-model=”data.company.name” label=”Company Name” class=”form-control”/> and my directive code:

Continue reading

Angular dirrectives and ng-class

Issue Suppose a directive with html e.g. in component.html like <div class=”text-field” ng-class=”{‘classA’: varA}”> …. </div> then I’m trying to do… <component ng-class=”{‘classB’: varB}”></component> After that in ng-class I’m having something like {‘classB’: varB} {‘classA’: varA} that is obviously not

Continue reading

Angular 9 ng-content dynamic update

Issue how i can update ng-content by updating selector on content elements? I have code in app.component.html: <my-slider> <img src="../../assets/logo1.png" /> <img src="../../assets/logo2.png" /> </my-slider> Here’s the code my-slider.component.ts: @Component({ selector: ‘my-slider’, template: ‘<ng-content select=".render" ></ng-content> <button (click)="render()"> Show</button>’, styleUrls:

Continue reading

Axios post multipart with object

Issue Here is my spring boot endpoint to post file and object in one request @PostMapping( value = ["/add"], consumes = [ MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE ] ) fun addUser( @RequestPart("user") user: UserDTO, @RequestPart("file") file: MultipartFile, ): Long = userService.addUser(user,

Continue reading

Why am I obtaining this strange behavior trying to use different color for different event type dragged into a PrimeNG FullCalendar component?

Issue I am working on an Angular application using PrimeNG Full Calendar component, this one: https://primefaces.org/primeng/showcase/#/fullcalendar That is based on the Angular FullCalendar component, this one: https://fullcalendar.io/ Here you can find my entire code: https://bitbucket.org/dgs_poste_team/soc_calendar/src/master/ I am finding some difficulties

Continue reading

Detect long click on tablet with ng-click or jquery

Issue Hi I’ve got follow div: angular.module(“myApp”, [‘ngTouch’]).controller(“myController”, function($scope) { $scope.longClick = function() { console.log(‘I was clicked long’); } }); .longClick { width: 200px; height: 20px; line-height: 20px; color: white; font-family: Arial; background-color: grey; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-touch.js”></script> <script

Continue reading

How to use jQuery longclick?

Issue I am using datatables plugin and using this for click: $(‘.datatable’).on(‘click’, ‘img#openpli-playlist’, function(e) { alert(“You clicked OPENPLI ICON!”); }); Now I need to use jQuery plugin longclick and using this: $(‘.datatable’).longClick(function(e) { alert(“You clicked OPENPLI ICON!”); },1000); So the

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

How do I call .then after .callMethod returns in Dart?

Issue I am trying to load a .czml file into a Cesium map using Dart. The javascript code works correctly and looks like this var viewer = new Cesium.Viewer(‘cesiumContainer’); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new Cesium.CzmlDataSource(); czmlDataSource.loadUrl(‘Vehicle.czml’).then(function() { viewer.dataSources.add(czmlDataSource); });

Continue reading

Long Polling Becoming a Ghost

Issue I’m creating a notification system that instantly checks to see if there are any new notifications for an online user. Here is my script so far: //…include(myscripts.php)… function notificationsCount($id) { if(is_numeric($id) && !empty($id) && $id>0) return mysql_result(mysql_query("SELECT COUNT(*) FROM

Continue reading

angular-tree-component:Generic type 'ModuleWithProviders<T>' requires 1 type argument(s)

Issue i am using angular v10 and "angular-tree-component": "^8.5.6".but getting build error: ERROR in node_modules/angular-tree-component/dist/angular-tree-component.d.ts:25:23 – error TS2314: Generic type ‘ModuleWithProviders<T>’ requires 1 type argument(s). 25 static forRoot(): ModuleWithProviders; Using in the application like this @NgModule({ imports: [TreeModule], exports: [TreeModule]

Continue reading

Scoping issue in callback function in AngularJS controller

Issue I have the following angular app (JSFiddle): HTML <form data-ng-app=”jsApDemo” data-ng-controller=”loginCtrl”> <label for=”username”>Username:</label> <input type=”text” id=”username” data-ng-model=”username” /> <br /> <label for=”password”>Password:</label> <input type=”password” id=”password” data-ng-model=”password” /> <br /> <button type=”submit” data-ng-click=”executeLogIn()”>Log in</button> <br /> <label for=”authstatus”>Authentication status:</label> <input

Continue reading

Why value is "Undefined" after passing to controller function

Issue I am not sure why console.log says undefined $scope.onSizeSelected = function(productId, sizeQtyPrice){ console.log(‘size selected …’ + sizeQtyPrice); $scope.updateSelectedProductBySizeSelected(productId ,sizeQtyPrice); }; My html div tag: <div ng-show=”product[0].sizeQtyPrice[0].size > 0″ ng-init=”onSizeSelected(product[0].id, product[0].sizeQtyPrice[0])” >Select a Size</div> My http inside controller: $http.get(“/get_product_details/?prod_id=1”) .success(function

Continue reading

Card Carousel Angularjs

Issue I am trying to implement this animation Jargon.html <ion-view title=”Jargon”> <ion-content> <a class=”item” href=”#/jargon”></a> <div class=”container”> <div data-card=”4″ class=”card”><span>Click Me</span></div> <div data-card=”3″ class=”card”><span>Click Me</span></div> <div data-card=”2″ class=”card”><span>Click Me</span></div> <div data-card=”1″ class=”card”><span>Click Me</span></div> <div data-card=”0″ class=”card”><span>Click Me</span></div> </div> </ion-content> The

Continue reading

Angularjs is not giving data from controller

Issue I am new to AngularJS. I am following MEAN Stack Intro: Build an end-to-end application I have simple html file to test angularjs. index.html <html> <head> <meta charset=”utf-8″> <title>Stack POC</title> <script type=”application/javascript” src=”app/scripts/controllers/user_controller.js”></script> <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css” integrity=”sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7″ crossorigin=”anonymous”> </head>

Continue reading

AngularJs – Using ng-controller with ng-include

Issue This works: <div ng-include=”‘login.html'” flex ng-if=”!loggedIn” ng-controller=”LoginController”></div> However, this doesn’t ({{test}} outputs nothing): <ng-include src=”‘login.html'” flex ng-if=”!loggedIn” ng-controller=”LoginController”></ng-include> Is there any reason? Or is it a bug? login.html: <p>{{test}}</p> LoginController: function LoginController($scope){ $scope.test = ‘login’; } Solution I’m not

Continue reading

How to use same ng-app for 2 different html page?

Issue I have 2 html page and one app.js my search-movie.html code as the following : <!DOCTYPE html> <html ng-app=”adphorusWork”> <head lang=”en”> <meta charset=”UTF-8″> <title>Search Movie</title> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link rel=”stylesheet” href=”http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css”> <script src=”scripts/angular.min.js”></script> <script src=”scripts/angular-route.min.js”></script> <script src=”scripts/jquery-1.9.1.min.js”></script> <script

Continue reading

angularjs two ng controllers with resolve conflict in html markup

Issue Here is my : config.router.js app.config([‘$stateProvider’, ‘$urlRouterProvider’, ‘$controllerProvider’, ‘$compileProvider’, ‘$filterProvider’, ‘$provide’, ‘$ocLazyLoadProvider’, ‘JS_REQUIRES’, function ($stateProvider, $urlRouterProvider, $controllerProvider, $compileProvider, $filterProvider, $provide, $ocLazyLoadProvider, jsRequires) { app.controller = $controllerProvider.register; app.directive = $compileProvider.directive; app.filter = $filterProvider.register; app.factory = $provide.factory; app.service = $provide.service; app.constant

Continue reading