Search Posts

Category: angularjs-directive

How can I pass event object to a method which is in angularJs directive

I developed a modal directive. I want to get the event which fired through a button click in modal.My angularJs code is given below, var myModal = angular.module(‘myModal’, []); myModal.controller(‘mymodalcontroller’, function ($scope) { $scope.header = ‘Put here your header’; $scope.body = ‘Put here your body’; $scope.footer = ‘Put here your footer’; $scope.myRightButton = function () { // I want the event here to perform some task alert(‘!!! first function call!’); }; }); myModal.directive(‘modal’, function () […]

how to call $cookies variable in module

i have following method and i want to show rights if isadmin = ‘1’ show this manuitem and if isadmin = ‘0’ not show this manu how to solve this type of logic please help me this thanks, when i refresh my url its work but when i logout and again login its not working (function () { ‘use strict’; angular .module(‘app.adduserbrand’, []) .config(config); /** @ngInject */ function config($stateProvider, $translatePartialLoaderProvider, msApiProvider, msNavigationServiceProvider) { // State […]

Angular JS-Storing the row wise table values into the database

I have this situation: I need to bring-up a table structure into a HTML page.One of the columns in this table has to be brought from a table stored in the database.This column value along with two check boxes values needs to be stored in a database and next time these stored values should be brought in ,next time we open that page HTML code: <label class=”col-md-3″ for=”Documents”>Test:</label> <div class=”col-md-8″ ng-controller=”checklistController” ng-init=’populateChecklist()’> <div class=”table-responsive”> <table […]

compiler.compileModuleAndAllComponentsAsync is taking more time to compile component having (Long Template HTML) and load the component

I am attempting to load a template(HTML) from server dynamically at runtime , render it and bind to Ionic page . i am using a dynamic method to create a component dynamically function createDynamicComponent(html) and passing html to it and keeping html code as template to the dynamic component getdata(url){ let instance=this; this.http.get(url) .subscribe((data:any) => { // debugger; // this.binddata(data._body); console.log(data._body); this.compiler.clearCache() this.compiler.compileModuleAndAllComponentsAsync(createDynamicComponent(data._body)) .then((mwcf: ModuleWithComponentFactories<any>) => { let factory: ComponentFactory<any> = mwcf.componentFactories.find(cf => === […]

Modal popup using angular 1.6 component

I am new in angular. The version of angular I am using is 1.6. I need to show a popup to display some data and fetch results back. Is it possible to create a separate component for that popup modal or is there any plugin available. I am not able to use any bootstrap or material css. Please suggest me a sample Source: AngularJS

AngularJS Directive. Page loader with delay and ignore if already success

I’m creating a page loader with angular-route while my page is rendering the display. I already used $timeout then $timeout.cancel but the page is still rendering, it doesn’t show the loader. DIRECTIVE pageLoad.directive(‘pageLoad’, [‘$rootScope’,’$timeout’, function ($rootScope,$timeout) { return { link: function (scope, element) { var startTimeout; element.addClass(‘ng-hide’); var unregister = $rootScope.$on(‘$routeChangeStart’, function () { startTimeout = $timeout(function() { if(element.hasClass(‘ng-hide’)){ element.removeClass(‘ng-hide’); } }, 10); }); var unregister = $rootScope.$on(‘$routeChangeSuccess’, function () { $timeout.cancel(startTimeout); if(!element.hasClass(‘ng-hide’)){ element.addClass(‘ng-hide’); } […]

AngularJs Page Refresh Gives 404 Page not found on server

this routing working fine on loaclhost. but when I deploy my application on server and refresh any page it shows error of 404 error page not found. below is my routing $routeProvider .when(“/”, { templateUrl: “/views/login.cshtml” }) .when(“/Login”, { templateUrl: “/Views/login.cshtml” }) .when(“/adminlogin”, { templateUrl: “/views/login.cshtml” }) .when(“/Register”, { templateUrl: “/Views/Register.cshtml” }) .when(“/blue”, { templateUrl: “blue.htm” }).otherwise(‘/’, { redirectTo: ‘/’ }); $locationProvider .html5Mode(true) anyone knows the solution kindly share. Source: AngularJS

Is there a way to reload an angular.js directive outside of the ui-view?

I’m working on an app that has a component outside the ui-view (navigation bar). This component includes a directive that should add a listener to some async event that happens after $location changes. I have the same directive in numerous places within the ui-view. The problem is that while the directives within the ui-view are re-rendered with every $location change, the directive within the navigation bar doesn’t re-render and the listener isn’t assigned. Any idea […]

how can i disable save button for a form of field with same label but different ng-model angular js

I’m a newbie. I have code something like this in which has multiple same label(AGE) field (Though form has many other files too)but with different ng-model and name attribute. All i want is to keep the save button disabled until all the Age fields are entered. <table> <tbody> <tr> <td>Age</td> <td> <input type=”text” default=”0″ id=”_AGE_1_” name=”AGE_1″ ng-model=”AGE_1″></td> </tr> <tr> <td>Age</td> <td> <input type=”text” default=”0″ id=”AGE_2_” name=”_AGE_2″ ng-model=”AGE_2″></td> </tr> <tr> <td>Age</td> <td> <input type=”text” default=”0″ id=”AGE_3_” […]

forEach not hitting last index’s

Hello I’m looping through an array within my Angular Controller and passing a Promise function to each value, then dynamically creating a $scope module for each one labeled “$scope[‘index_0]” for example. app.controller(‘arrCtrl’, function($scope, dataService){ var catList = <%-JSON.stringify(myCats)%>; var sequence = Promise.resolve(); catList.forEach(function(catObj, index){ sequence = sequence.then(function(){ return dataService.getItemsByCategory(catObj._id); }).then(function(result){ //Create and set scope module to Items array $scope[‘items_’+index] = result; }).catch(function(err){//catch any error console.log(err + ‘ failed to load!’); }); }); console.log(“Controller loaded”); }); […]

Next Page »