Search Results

Search found 2562 results on 103 pages for 'angularjs ng repeat'.

Page 4/103 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Unable to update value of Select from AngularJs

    - by Ahmad.Masood
    I am unable to update value of select from AngularJs. Here is my code <select ng-model="family.grade" > <option ng-repeat="option in options" value='{{option.id}}'>{{option.text}}</option> </select> Here are the options which i am using to populate my select var options = [{text:'Pre-K',id:'Pre-K'}, {text:'K',id:'K'}, {text:'1',id:'1'}, {text:'2',id:'2'}, {text:'3',id:'3'}, {text:'4',id:'4'}, {text:'5',id:'5'}, {text:'6',id:'6'}, {text:'7',id:'7'}, {text:'8',id:'8'}, {text:'+',id:'+'}]; Here is mu js code. $scope.$watch("family_member.date_of_birth" ,function(newValue, oldValue){ $scope.family.grade = "1" }) When ever value of family_member.date_of_birth changes it should set they value of select to 1. But this change is not visible on UI.

    Read the article

  • Lemonldap::ng + OpenID error in try generate

    - by spy86
    I am trying to configure authentication by OpenID in lemonldap::ng with this When I try http://auth.example.com/openidserver/username, I see following error: Unable to load Net::OpenID::Server Base class package "Net::OpenID::Server" is empty. (Perhaps you need to 'use' the module which defines that package first, or make that module available in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd). at /usr/share/perl5/vendor_perl/Lemonldap/NG/Portal/OpenID/Server.pm line 9 BEGIN failed--compilation aborted at /usr/share/perl5/vendor_perl/Lemonldap/NG/Portal/OpenID/Server.pm line 9, line 522. Compilation failed in require at /usr/share/perl5/vendor_perl/Lemonldap/NG/Portal/IssuerDBOpenID.pm line 40, line 522. LemonLDAP::NG Lemonldap::ng works in CentOS 6.4 and server have all update's

    Read the article

  • password-check directive in angularjs

    - by mpm
    I'm writing a password verify directive : Directives.directive("passwordVerify",function(){ return { require:"ngModel", link: function(scope,element,attrs,ctrl){ ctrl.$parsers.unshift(function(viewValue){ var origin = scope.$eval(attrs["passwordVerify"]); if(origin!==viewValue){ ctrl.$setValidity("passwordVerify",false); return undefined; }else{ ctrl.$setValidity("passwordVerify",true); return viewValue; } }); } }; }); html : <input data-ng-model='user.password' type="password" name='password' placeholder='password' required> <input data-ng-model='user.password_verify' type="password" name='confirm_password' placeholder='confirm password' required data-password-verify="user.password"> Given 2 password fields in a form, if both password values are equal then the field affected by the directive is valid. The issue is that it works one way (i.e. when I type a password in the password-verify field). However, when the original password field is updated, the password-verify doesn't become valid. Any idea how I could have a "two way binding verify?"

    Read the article

  • Using Angularjs with server side templates

    - by codecollision
    For SEO purposes the server renders out the full html template for a given URL on initial load. The site uses angularjs which detects the URL route and renders a client template from the JSON API. For example, you navigate to: /blog/post-title Server responds with post-title content. Angular loads, detects route: /blog/:post_slug and begins to load JSON and render client side template from response. Obviously what Angular does is fine when links are followed after the initial load, but on first load it duplicates effort. My question is if there is a clean way to prevent this situation.

    Read the article

  • Is angularjs capable of filtering based on keywords?

    - by Alex90
    I have 30 categories in mysql. I have 450 subcategories which are related to the 30 categories in another table. Categories table id _ title _ Keywords 1 _ Animals _ animal, animals, pet, parrot 2 _ Books _ books, book, educational n _ xxx _ xxx Subcategories table id _ ref _ title _ keywords 1 _ 1 _ cats _ cats, persian cat, bengal cat 2 _ 1 _ dogs _ dogs, labrador, golder retriver 3 _ 2 _ Classic _ The davinci code, books, book, classical books I need to implement the filter to a textfield. If the users enters labrador in the textfield then show the categories or/and subcategories which contain 'labrador' in the keywords. In this case the "dogs" subcategory would appear! I know that this has been done using jquery. But is there anyway to implement this with angularJs? If you got a jsfiddle then it would be awesome! :) Thank you

    Read the article

  • AngularJS, changing the data in a view without div disappearing

    - by Jascination
    I'm making a little wizard/survey in AngularJS which loads in data to a variable, $scope.styles. I've set up a plunkr for ease of use here: http://plnkr.co/edit/1S542YE7xlO2P4zyhzu0?p=preview Pretty simple. I show each object to the user in succession, which loads in the pertinent images and displays them for the user. clicking "yes/no" at the bottom of the images it loads in the next gallery. There is a big of lag between the refresh here (Plunkr seems to be loading it quite quickly, but this is not the case on my production server so it's even more noticable) which causes the window size to momentarily be much smaller plus all the content below the ng-repeat jumps to the top of the screen. What's the best way to prevent this from happening? Is CSS the only solution here?

    Read the article

  • Protecting routes with authentication in an AngularJS app

    - by Chris White
    Some of my AngularJS routes are to pages which require the user to be authenticated with my API. In those cases, I'd like the user to be redirected to the login page so they can authenticate. For example, if a guest accesses /account/settings, they should be redirected to the login form. From brainstorming I came up with listening for the $locationChangeStart event and if it's a location which requires authentication then redirect the user to the login form. I can do that simple enough in my applications run() event: .run(['$rootScope', function($rootScope) { $rootScope.$on('$locationChangeStart', function(event) { // Decide if this location required an authenticated user and redirect appropriately }); }]); The next step is keeping a list of all my applications routes that require authentication, so I tried adding them as parameters to my $routeProvider: $routeProvider.when('/account/settings', {templateUrl: '/partials/account/settings.html', controller: 'AccountSettingCtrl', requiresAuthentication: true}); But I don't see any way to get the requiresAuthentication key from within the $locationChangeStart event. Am I overthinking this? I tried to find a way for Angular to do this natively but couldn't find anything.

    Read the article

  • How to change the content of a tab while you are on the same tab using AngularJS and Bootstrap?

    - by user2958608
    Using AngularJS and Bootstrap, let say there are 3 tabs: tab1, tab2, and tab3. There are also some links on each tabs. Now for example, tab1 is active. The question is: how to change the content of the tab1 by clicking a link within the same tab? main.html: <div class="tabbable"> <ul class="nav nav-tabs"> <li ng-class="{active: activeTab == 'tab1'}"><a ng-click="activeTab = 'tab1'" href="">tab1</a></li> <li ng-class="{active: activeTab == 'tab2'}"><a ng-click="activeTab = 'tab2'" href="">tab2</a></li> <li ng-class="{active: activeTab == 'tab3'}"><a ng-click="activeTab = 'tab3'" href="">tab3</a></li> </ul> </div> <div class="tab-content"> <div ng-include="'/'+activeTab"></div> </div> tab1.html: <h1>TAB1</h1> <a href="/something">Something</a> something.html <h1>SOMETHING</h1> Now the question is how to change the tab1 content to something.html while the tab1 is active?

    Read the article

  • AngularJS: download pdf file from the server

    - by Bartosz Bialecki
    I want to download a pdf file from the web server using $http. I use this code which works great, my file only is save as a html file, but when I open it it is opened as pdf but in the browser. I tested it on Chrome 36, Firefox 31 and Opera 23. This is my angularjs code (based on this code): UserService.downloadInvoice(hash).success(function (data, status, headers) { var filename, octetStreamMime = "application/octet-stream", contentType; // Get the headers headers = headers(); if (!filename) { filename = headers["x-filename"] || 'invoice.pdf'; } // Determine the content type from the header or default to "application/octet-stream" contentType = headers["content-type"] || octetStreamMime; if (navigator.msSaveBlob) { var blob = new Blob([data], { type: contentType }); navigator.msSaveBlob(blob, filename); } else { var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; if (urlCreator) { // Try to use a download link var link = document.createElement("a"); if ("download" in link) { // Prepare a blob URL var blob = new Blob([data], { type: contentType }); var url = urlCreator.createObjectURL(blob); $window.saveAs(blob, filename); return; link.setAttribute("href", url); link.setAttribute("download", filename); // Simulate clicking the download link var event = document.createEvent('MouseEvents'); event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); link.dispatchEvent(event); } else { // Prepare a blob URL // Use application/octet-stream when using window.location to force download var blob = new Blob([data], { type: octetStreamMime }); var url = urlCreator.createObjectURL(blob); $window.location = url; } } } }).error(function (response) { $log.debug(response); }); On my server I use Laravel and this is my response: $headers = array( 'Content-Type' => $contentType, 'Content-Length' => strlen($data), 'Content-Disposition' => $contentDisposition ); return Response::make($data, 200, $headers); where $contentType is application/pdf and $contentDisposition is attachment; filename=" . basename($fileName) . '"' $filename - e.g. 59005-57123123.PDF My response headers: Cache-Control:no-cache Connection:Keep-Alive Content-Disposition:attachment; filename="159005-57123123.PDF" Content-Length:249403 Content-Type:application/pdf Date:Mon, 25 Aug 2014 15:56:43 GMT Keep-Alive:timeout=3, max=1 What am I doing wrong?

    Read the article

  • Loading Modules in Angular

    - by SL Dev
    I'm new to AngularJS. In my efforts to learn, I've relied on the AngularJS tutorials. Now, I'm trying to build an app using the AngularSeed project template. I'm trying to make my project as modular as possible. For that reason, my controllers are broken out into several files. Currently, I have the following: /app index.html login.html home.html javascript app.js loginCtrl.js homeCtrl.js my app.js file has the following: 'use strict'; var app = angular.module('site', ['ngRoute']); app.config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider.when('/login', {templateUrl: 'app/login.html', controller:'loginCtrl'}); $routeProvider.when('/home', {templateUrl: 'app/home.html', controller:'homeCtrl'}); $routeProvider.otherwise({redirectTo: '/login'}); }); my loginCtrl.js file is very basic at the moment. It only has: 'use strict'; app.controller('loginCtrl', function loginCtrl($scope) { } ); My homeCtrl.js is almost the same, except for the name. It looks like the following: 'use strict'; app.controller('homeCtrl', function homeCtrl($scope) { } ); My index.html file is the angularSeed index-async.html file. However, when I load the dependencies, I have the following: // load all of the dependencies asynchronously. $script([ 'http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.min.js', 'http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular-route.min.js', 'javascript/app.js', 'javascript/loginCtrl.js', 'javascript/homeCtrl.js' ], function() { // when all is done, execute bootstrap angular application angular.bootstrap(document, ['site']); }); My problem is, sometimes my app works and sometimes it doesn't. It's almost like something gets loaded before something else. Occasionally, I receive this error. Other times, I get an error in the console window that says: 'Uncaught ReferenceError: app is not defined' in loginCtrl.js. Sometimes it happens with homeCtrl.js. What am I doing wrong? It feels like I need to have my controllers in a module and pass that module in my app.config in the app.js file. However, a) I'm not sure if that allowed and b) I'm not sure how to do it.

    Read the article

  • Angular ng-style not changing with property

    - by ganaraj
    For the life of me I cant seem to figure out why the style property is not getting updated. In my larger application it seems to work fine. http://jsfiddle.net/ganarajpr/C2hRa/4/ Here is a fiddle which shows the issue I am currently facing. You will notice that the width and height are getting updated in the div when you change the input. But the style itself doesnt seem to be updating. Anyone can tell me what I am doing wrong here? I have tried all the following scenarios using $scope.$apply.. - Throws an error stating $apply already in progress.. $rootScope.$apply - same as above. Setting another variable in a service which is $watched in the other controller. - no change seen. It would be really cool if someone can get me an answer to this. Also would be really happy if you can tell me why exactly it is not getting updated.

    Read the article

  • Display image background fully for last repeat in a div

    - by Stiggler
    I have a 700x300 background repeating seamlessly under the main content-div. Now I'd like to attach a div at the bottom of the content-div, containing a continuation-to-end of the background image, connecting seamlessly with the background above it. Due to the nature of the pattern, unless the full 300px height of the background image is visible in the last repeat of the content-div's backround, the background in the div below won't seamlessly connect. Basically, I need the content div's height to be a multiple of 300px under all circumstances. What's a good approach to this sort of problem? I've tried resizing the content-div on loading the page, but this only works as long as the content div doesn't contain any resizing, dynamic content, which is not my case: function adjustContentHeight() { // Setting content div's height to nearest upper multiple of column backgrounds height, // forcing it not to be cut-off when repeated. var contentBgHeight = 300; var contentHeight = $("#content").height(); var adjustedHeight = Math.ceil(contentHeight / contentBgHeight); $("#content").height(adjustedHeight * contentBgHeight); } $(document).ready(adjustContentHeight); What I'm looking for there is a way to respond to a div resizing event, but there doesn't seem to be such a thing. Also, please assume I have no access to the JS controlling the resizing of content in the content-div, though this is potentially a way of solving the problem. Another potential solution I was thinking off was to offset the background image in the bottom div by a certain amount depending on the height of the content-div. Again, the missing piece seems to be the ability to respond to a resize event.

    Read the article

  • apt-cacher ng / upgrade fails from client

    - by todayis23
    I'm running apt-cacher ng on an Ubuntu Hardy server and try to upgrade the packages on a Natty client (which was initially a Maverick). I didn't do anything on the server. On the client I tried two setups. I configure APT to use a http-proxy. On the client I did a "apt-get update" which worked fine, but very slowly. In the acng-report.html I see an entry, which seems to be correct. After verifying Install these packages without verification [y/N]? y "apt-get upgrade" failes with the message: Err http://archive.ubuntu.com/ubuntu/ natty-updates/main libnux-0.9-common all 0.9.48-0ubuntu1.1 503 Name or service not known The GUI update manager fails as well with the message, that untrusted packages will be installed. I edit sources.list and add the server in the correct format to all sources. "apt-get update" is very slowly... and I get a lot of errors like this: W: Failed to fetch http://[::ffff:10.10.10.10]:3142/archive.ubuntu.com/ubuntu/dists/natty/main/binary-i386/Packages 403 Forbidden file type or location After that "apt-get upgrade" says: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. What could be wrong? Is it possible to use apt-cacher ng on an older system for upgrading newer systems? Thank you in advance!

    Read the article

  • Repeat a part of spritesheet as background

    - by Moiblpadde
    So I'm trying to repeat a part of my spritesheet as a background (js, canvas). My code so far: var canvas = $("#board")[0], ctx = canvas.getContext("2d"), sprite = new Image(); sprite.src = "spritesheet.png"; sprite.onload = function(){ ctx.fillStyle = ctx.createPattern(spriteBg, "repeat"); ctx.fillRect(0, 25, 500, 500); } This is fine, but as you can see, it repeat the whole sprite, not just a part of it, and I just can't figure out how to do it D:

    Read the article

  • ngGrid reusable filter AngularJS

    - by wootscootinboogie
    I have a business requirement that I filter a boolean value in my ngGrid. The filter has three states: only true, only false and both. Filtering like this seems to be a common enough use case that I should refactor that functionality out of my code for re use (possibly in a directive/filter?). I'd like to know how I can go about pulling out the customFilter function in my controller and make it so that I can pass the filter a property name on which to filter, and a value for selectedFilterOption. The code currently works, but I feel like this is a good chance to get better at angular :). So how can I pull out my filtering used here and make it a reusable piece of functionality? app.controller('DocumentController',function($scope,DocumentService) { $scope.filterOptions = { filterText: '', useExternalFilter: false }; $scope.totalServerItems =0; $scope.pagingOptions ={ pageSizes: [5,10,100], pageSize: 5, currentPage: 1 } //filter! $scope.dropdownOptions = [{ name: 'Show all' },{ name: 'Show active' },{ name: 'Show trash' }]; //default choice for filtering is 'show active' $scope.selectedFilterOption = $scope.dropdownOptions[1]; //three stage bool filter $scope.customFilter = function(data){ var tempData = []; angular.forEach(data,function(item){ if($scope.selectedFilterOption.name === 'Show all'){ tempData.push(item); } else if($scope.selectedFilterOption.name ==='Show active' && !item.markedForDelete){ tempData.push(item); } else if($scope.selectedFilterOption.name ==='Show trash' && item.markedForDelete){ tempData.push(item); } }); return tempData; } //grabbing data $scope.getPagedDataAsync = function(pageSize, page, filterValue, searchText){ var data; if(searchText){ var ft = searchText.toLowerCase(); DocumentService.get('filterableData.json').success(function(largeLoad){ //filter the data when searching data = $scope.customFilter(largeLoad).filter(function(item){ return JSON.stringify(item).toLowerCase().indexOf(ft) != -1; }) $scope.setPagingData($scope.customFilter(data),page,pageSize); }) } else{ DocumentService.get('filterableData.json').success(function(largeLoad){ var testLargeLoad = $scope.customFilter(largeLoad); //filter the data on initial page load when no search text has been entered $scope.setPagingData(testLargeLoad,page,pageSize); }) } }; //paging $scope.setPagingData = function(data, page, pageSize){ var pagedData = data.slice((page -1) * pageSize, page * pageSize); //filter the data for paging $scope.myData = $scope.customFilter(pagedData); $scope.myData = pagedData; $scope.totalServerItems = data.length; if(!$scope.$$phase){ $scope.$apply(); } } //watch for filter option change, set the data property of gridOptions to the newly filtered data $scope.$watch('selectedFilterOption',function(){ var data = $scope.customFilter($scope.myData); $scope.myData = data; $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); $scope.setPagingData($scope.myData,$scope.pagingOptions.currentPage,$scope.pagingOptions.pageSize); }) $scope.$watch('pagingOptions',function(newVal, oldVal){ if(newVal !== oldVal && newVal.currentPage !== oldVal.currentPage){ $scope.getPagedDataAsync($scope.pagingOptions.pageSize,$scope.pagingOptions.currentPage,$scope.filterOptions.filterText); } },true) $scope.message ="This is a message"; $scope.gridOptions = { data: 'myData', enablePaging: true, showFooter:true, totalServerItems: 'totalServerItems', pagingOptions: $scope.pagingOptions, filterOptions: $scope.filterOptions, showFilter: true, enableCellEdit: true, showColumnMenu: true, enableColumnReordering: true, enablePinning: true, showGroupPanel: true, groupsCollapsedByDefault: true, enableColumnResize: true } //get the data on page load $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); }); HTML

    Read the article

  • AngularJS service returning promise unit test gives error No more request expected

    - by softweave
    I want to test a service (Bar) that invokes another service (Foo) and returns a promise. The test is currently failing with this error: Error: Unexpected request: GET foo.json No more request expected Here are the service definitions: // Foo service returns new objects having get function returning a promise angular.module('foo', []). factory('Foo', ['$http', function ($http) { function FooFactory(config) { var Foo = function (config) { angular.extend(this, config); }; Foo.prototype = { get: function (url, params, successFn, errorFn) { successFn = successFn || function (response) {}; errorFn = errorFn || function (response) {}; return $http.get(url, {}).then(successFn, errorFn); } }; return new Foo(config); }; return FooFactory; }]); // Bar service uses Foo service angular.module('bar', ['foo']). factory('Bar', ['Foo', function (Foo) { var foo = Foo(); return { getCurrentTime: function () { return foo.get('foo.json', {}, function (response) { return Date.parse(response.data.now); }); } }; }]); Here is my current test: 'use strict'; describe('bar tests', function () { var currentTime, currentTimeInMs, $q, $rootScope, mockFoo, mockFooFactory, Foo, Bar, now; currentTime = "March 26, 2014 13:10 UTC"; currentTimeInMs = Date.parse(currentTime); beforeEach(function () { // stub out enough of Foo to satisfy Bar service: // create mock object with function get: function(url, params, successFn, errorFn) // that promises to return a response with this property // { data: { now: "March 26, 2014 13:10 UTC" }}) mockFoo = { get: function (url, params, successFn, errorFn) { successFn = successFn || function (response) {}; errorFn = errorFn || function (response) {}; // setup deferred promise var deferred = $q.defer(); deferred.resolve({data: { now: currentTime }}); return (deferred.promise).then(successFn, errorFn); } }; // create mock Foo service mockFooFactory = function(config) { return mockFoo; }; module(function ($provide) { $provide.value('Foo', mockFooFactory); }); module('bar'); inject(function (_$q_, _$rootScope_, _Foo_, _Bar_) { $q = _$q_; $rootScope = _$rootScope_; Foo = _Foo_; Bar = _Bar_; }); }); it('getCurrentTime should return currentTimeInMs', function () { Bar.getCurrentTime().then(function (serverCurrentTime) { now = serverCurrentTime; }); $rootScope.$apply(); // resolve Bar promise expect(now).toEqual(currentTimeInMs); }); }); The error is being thrown at $rootScope.$apply(). I also tried using $rootScope.$digest(), but it gives the same error. Thanks in advance for any insight you can give me.

    Read the article

  • JSDoc with AngularJS

    - by Nick White
    Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use ngDoc but this isn't really a viable option as we will always have separate JavaScript and I ideally would have everything together. /** * @author Example <[email protected]> * @copyright 2014 Example Ltd. All rights reserved. */ (function () { window.example = window.example || {}; /** * Example Namespace * @memberOf example * @namespace example.angular */ window.example.angular = window.example.angular || {}; var exAngular = window.example.angular; /** * A Example Angular Bootstrap Module * @module exampleAngularBootstrap */ exAngular.bootstrap = angular.module('exampleAngularBootstrap', [ 'ngRoute', 'ngResource', 'ngCookies' ]) .run(function ($http, $cookies) { $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; $http.defaults.headers.common['X-CSRFToken'] = $cookies.csrftoken; }); })(); Currently this is what I have but am unable to put documentation for the run() any ideas? Thank you in advanced!

    Read the article

  • AngularJS - $routeParams Empty on $locationChangeSuccess

    - by Marc M.
    I configure my app in the following run block. Basically I want to preform an action that requires me to know the $routeParams every $locationChangeSuccess. However $routeParams is empty at this point! Are there any work rounds? What's going on? app.run(['$routeParams', function ($routeParams) { $rootScope.$on("$locationChangeSuccess", function () { console.log($routeParams); }); }]); UPDATE function configureApp(app, user) { app.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/rentroll', { templateUrl: 'rent-roll/rent-roll.html', controller: 'pwRentRollCtrl' }). when('/bill', { templateUrl: 'bill/bill/bill.html', controller: 'pwBillCtrl' }). when('/fileroom', { templateUrl: 'file-room/file-room/file-room.html', controller: 'pwFileRoomCtrl' }). when('/estate-creator', { templateUrl: 'estate/creator.html' }). when('/estate-manager', { templateUrl: 'estate/manager.html', controller: 'pwEstateManagerCtrl' }). when('/welcomepage', { templateURL: 'welcome-page/welcome-page.html', controller: 'welcomePageCtrl' }). otherwise({ redirectTo: '/welcomepage' }); }]); app.run(['$rootScope', '$routeParams', 'pwCurrentEstate','pwToolbar', function ($rootScope, $routeParams, pwCurrentEstate, pwToolbar) { $rootScope.user = user; $rootScope.$on("$locationChangeSuccess", function () { pwToolbar.reset(); console.log($routeParams); }); }]); } Accessing URL: http://localhost:8080/landlord/#/rentroll?landlord-account-id=ahlwcm9wZXJ0eS1tYW5hZ2VtZW50LXN1aXRlchwLEg9MYW5kbG9yZEFjY291bnQYgICAgICAgAoM&billing-month=2014-06

    Read the article

  • Setting location based on previous parameter of $routeChangeError with AngularJS

    - by Moo
    I'm listening on events of the type $routeChangeError in a run block of my application. $rootScope.$on("$routeChangeError", function (event, current, previous, rejection) { if (!!previous) { console.log(previous); $location.path(previous.$$route.originalPath); } }); With the help of the previous parameter I would like to set the location to the previous page. This works as long as the "originalPath" of "previous.$$route" does not contain any parameters. If it contains parameters the "originalPath" is not transformed. Logging the previous objects returns the following output: $$route: Object ... originalPath: "/users/:id" regexp: /^\/users\/(?:([^\/]+)?)$/ ... params: Object id: "3" How can I set the location to the previous path including the parameters?

    Read the article

  • Angularjs code/naming conventions

    - by Dalorzo
    Does anyone know if exists any official or most accepted reference for Angular naming conventions to use when we build our applications? Angular has a lot of different type of components such as filters, directives, services and so on. Wouldn't you agree that having a reference naming convention when we implement them in our applications will make sense? For example: If we need to create new filters how should we name them like [Something]Filter or filter[Something] or something else? And same applies for Controllers, Services, Directives and so on. Other things I wonder about is if variables/functions that belongs to the scope should have an special prefix or suffix. In some situations it may be useful to have a way to differentiate them from functions and other (none angular code).

    Read the article

  • AngularJS - Processing $http response in service

    - by bsreekanth
    I recently posted a detailed description of the issue I am facing here at SO. As I couldn't send an actual $http request, I used timeout to simulate asynchronous behavior. Data binding from my model to view is working correct, with the help of @Gloppy Now, when I use $http instead of $timeout (tested locally), I could see the asynchronous request was successful and data is filled with json response in my service. But, my view is not updating. updated Plunkr here

    Read the article

  • AngularJS: Better way to display success messages

    - by Sup
    $('body').on('click', '#save-btn', function () { $('#greetingsModal').modal('show'); }); <div id="greetingsModal" class="modal hide fade" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true"> <div class="alert alert-success"> <a href="../admin/Supplier" class="close" data-dismiss="alert">x</a> <strong>Well done!</strong>. </div> I want to display a popup message using the above styles whenever 'save-btn' is clicked. The above code works fine but there is a lot of time delay by doing it this way. Is there any way to display such a alert message using angular?

    Read the article

  • Calling a Factory in AngularJS

    - by Kohjah Breese
    How do you call a factory? As defined below. angular.module('fb.services', []).factory('getQueryString', function () { return { call: function () { var result = {}, queryString = qs.substring(1), re = /([^&=]+)=([^&]*)/g, m; while (m = re.exec(queryString)) result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); return result; } } }); alert(getQueryString.call('this=that&me=you'));

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >