-
Dev555
javascript debugging angularjs angular
I am having problem in integrating AngularJS UI tinymce in the app however it is working fine in jsbin demo:http://jsbin.com/itevos/2However in app I receive this error when I load the app:Uncaught TypeError: Cannot read property ‘form’ of nullwhich references tiny_mce_jquery_src.js:11955 with that line number being:var n = t.getElement().form;In the app, I checked all js/css files are loaded fine. This is what I have:var app_htmleditor_module = angular.module(‘app_htmleditor’, [‘ui’, ‘component
-
Lightbulb1
javascript json angularjs angular
I’m writing a directive in angular to help validate fields. It is working up to the point of storing the result of the validation. I want to store it in an object like error.password.oldthe code to do this looks like this:if(!(typeof iAttrs.ngModel == “undefined”)) {var model = iAttrs.ngModel.split(‘.’);var length = model.length;var target = scope.error;if(typeof validation[iAttrs.validate] == “function”){for(var index = 0; index < length; index++){target = target[model[index]];}target = vali
-
Noah Freitas
angularjs angular
I am still very new to Angular.js and am working through setting up my first application. I would like to be able to do the following:angular.module(‘App.controllers’, []).controller(‘home’, function () {$scope.property = true;}]);angular.module(‘App’, [‘App.controllers’]).config([‘$routeProvider’, function($routeProvider) {$routeProvider.when(‘/’, {templateUrl: ‘partials/home.html’, controller: home});}]);Using this setup the following error is generated:Uncaught ReferenceError: home is not de
-
Thomas Kremmel
django json resources angularjs angular
I’m trying to make a post call using resources from angular.js and adding a success and error callback. wbsModule.factory(‘gridData’, function($resource) {//define resource classvar root = {{ root.pk }};var csrf = ‘{{ csrf_token }}’;return $resource(‘{% url getJSON4SlickGrid root.pk %}:wpID’, {wpID:’@id’},{get: {method:’GET’, params:{root : root }, isArray:true},update:{method:’POST’, headers: {‘X-CSRFToken’ : csrf }},}); });I’m calling the update action like this:args.item.$update([], successUp
-
mawo
javascript angularjs angular directive
I created a custom directive for the following widget attribute:Basically the directive just creates some template code and puts the html inside the widget-tag. Here’s the directive:skdApp.directive(“widget”, function() {return {restrict: ‘A’,template: htmlTemplate,link: function($scope, element, attri) {/** setup event handler and twitter bootstrap components here*/}}The htmlTemplate is basic html code which also uses custom directives (e.g. the <seal> tag):var htmlTemplate = ‘<div ng-
-
Amir
javascript rest angularjs angular
i’m trying to use angular with django i’ve implemented a REST api with django tastypie, here’s the code for the angular resource:angular.module(‘CourseServices’, [‘ngResource’]).factory(‘Course’, function($resource){return $resource(‘api/v1/course/:courseId/?format=json’, {}, {query: {method:’GET’, params:{courseId:’1′}, isArray:true}}); });and here is where i’m trying to get it:var course = Course.get({courseId:$routeParams.courseId}); console.log(course);this code logs this in the browser:Reso
-
Dustin
javascript angularjs angular
I have a directive that looks like this:app.directive(‘fieldsetCollapse’, function() { return {restrict: ‘A’,scope: {},compile: function(tElement, tAttrs, transclude) {var wrapperElement = angular.element(‘<div ng-show=”isOpen”></div>’),legendElement = tElement.find(‘legend’),collapsibleContent = tElement.children().not(‘legend’),toggleBtn = angular.element(‘<a href=”#” class=”twisty” ng-class=”{ true: \’twisty-open\’, false: \’twisty-closed\’ }[isOpen]” ng-click=”toggle()”><
-
Noel Yap
js-test-driver angular
I have the following code:function TestStats($xhr) {$xhr(‘GET’,’/test-dashboard/get-projects.json’,angular.bind(this, function(code, response) {this.projects = response.projects;this.projects.splice(0, 0, undefined);}));this.$watch(‘project’, angular.bind(this, function() {this.testClassStats = undefined;if (this.project) {$xhr(‘GET’,’/test-dashboard/get-test-stats.json?project=’ + this.project,angular.bind(this, function(code, response) {this.testClassStats = response.testClassStats;}));}})); }
-
Endless
jquery jquery-ajax jsonp angularjs angular
I tried out one of Angulars demo and wanted to play with jsonp. And i could not get it to work, so i pasted the same code into jsbin so i can ask you guys whats wrong with it. And notice that it worked.Tried the exact same code again on my dev-site. and it dose not work. i can see the network log in webkit that i get a valid json back with http code 200. but no callback is executed.I ended up trying out jQuery-Ajax on the same request and that worked fine. for me$(document).ready(function() {$.g
-
matsko
angularjs angular
I have an expensive function call that gets called once per loop, but I would like to set the return value of that to be a temporary variable that can be used directly within the loop.This works by setting {{ val=fn(…) }}, but it also prints to the screen. Is it possible to do this without printing the value?I’ve tried using one set of curly braces {} but it doesn’t work.Any ideas on how to do this?
-
Rick Kleinhans
events focus angularjs blur angular
I’m new to AngularJS and I’m making made a couple of custom Angular directives to do what I used to do with Jquery, however there is one case where I’m not sure if I’m doing it the “the angular way”. It works but I think there might be a better way.I want to do is this for a search box:When focus is on the search box the app must change the color of the text in the box from grey to black. The app must also then check the current text in the box, if it is the default text then the app must clear
-
I Hate Lazy
javascript scope closures angular
I am using Cordova and Angular for a small webapp. Here is the implementation process:LogsModel is created queryLogs() is called getLogsArray() is called – at this point, even in the function definition, console.log(this.logs[‘0’]) returns undefined. I do not understand why.LogsModel.prototype.logs = {};LogsModel.prototype.getLogsArray = function (){console.log(this.logs[‘0’]);return this.logs; };LogsModel.prototype.queryLogs = function (){var self = this;function getFromDb (tx){tx.executeSql(‘S
-
user1703761
javascript coffeescript angularjs angular
I’ve got some CoffeeScript classes which I use and extend in my code. How can I use angularjs to not have to create the usual module cruft like MyNamespace = MyNamespace || {} MyNamespace.SuperClass = classand in a different fileMyNamespace = MyNamespace || {} class ChildClass extends MyNamespace.SuperClass MyNamespace.ChildClass = ChildClassCould I simply writeangular(‘MyModule’).factory, ‘SuperClass’, () ->class SuperClassconstructor: (@id) ->return SuperClassand extend from that class v
-
Adio
javascript angularjs angular
In my application I need to delete an element from an array. However I am new to JS. I searched the web and every blog post was talking about splice() method. So I considered to used it, but it has a very strange behavior.Here the post I found : http://www.w3schools.com/jsref/jsref_splice.asp http://viralpatel.net/blogs/javascript-array-remove-element-js-array-delete-element/Here is my Test:it(“should delete all elements in array”, function () {var ary = new Array();for (i = 0; i < 10; i++)
-
user1703761
coffeescript angularjs angular
I’m trying to split my controllers into multiple files, but when i try to register them at my module im getting an error:groupcontroller.coffeeapp = angular.module(‘WebChat’, []); app.controller ‘GroupController’, ($scope) -> usercontroller.coffeeapp = angular.module(‘WebChat’, []); app.controller ‘UserController’, ($scope) -> ErrorError: Argument ‘GroupController’ is not a function, got undefinedFrom the documentation I dont really get what the module method does anyway. Does it store my
-
jpeskin
javascript mvc comet angularjs angular
I’m just starting to familiarize with Angular.js, but I would like to build a web app that has a view that gets auto-upated in real-time (no refresh) for the user when something changes in the server-side database.Can Angular handle this (mostly) automatically for me? And if so, what is the basic mechanism at work?For example, do you somehow setup Angular to poll the DB regularly for “model” changes? Or use some sort of Comet-like mechanism to notify Angular client-side code that the model has
-
Logan W
javascript angularjs angular
New to AngularJS and trying to get a grasp of the framework, and trying to build a basic CRUD app. I can’t seem to figure out what is needed to Update an existing record. Here is my service:angular.module(‘appServices’, [‘ngResource’]). factory(‘App’, function ($resource) {var Item = $resource(‘App/:AppId’, {//Default parametersAppId: ‘@id’}, {//Actionsquery: {method: ‘GET’,isArray: true},getById: {method: ‘PUT’},update: {method: ‘POST’}});return Item; });I can run a basic Get all query, and get
-
mikevvt
javascript mvc routing angularjs angular
Can I set a default value of a parameter of a route in angularjs ? Is there a way to have ‘/products/123’ and ‘/products/’ handled by the same route ?I’m looking to refactor my existing code, which looks like:myModule.config([‘$routeProvider’, function($routeProvider) {$routeProvider.when(‘/products/’, {templateUrl: ‘products.html’, controller: ProductsCtrl}). when(‘/products/:productId’, {templateUrl: ‘products.html’, controller: ProductsCtrl}) }]);function ProductsCtrl($scope, $rout
-
spadict
javascript angularjs angular
How can I move an element to different places in the DOM with angular js?I have a list of elements like so<ul id=”list” ng-controller=”ListController”><li ng-controller=”ItemController”><div>content</div></li><li ng-controller=”ItemController”><div>content</div></li><li ng-controller=”ItemController”><div>content</div></li><li ng-controller=”ItemController”><div>content</div><div id=”overlay”>&l
-
waigani
angularjs angular
I am trying to dynamically load a template within an ng-repeat:<ul><li ng-repeat=”prop in entity” ><div ng-include src=”prop.template”></div></li> </ul>prop.template equals the url of the template e.g. ‘partials/form/text.html’. The above code produces the following error:Error: 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [[“prop.template; newVal: \”partials/form/text.html\”; oldVal: undefined”,”prop.template; newVal: \”
-
shaunlim
javascript angularjs angular
Note: I also posted this question on the AngularJS mailing list here: https://groups.google.com/forum/#!topic/angular/UC8_pZsdn2UHi All,I’m building my first AngularJS app and am not very familiar with Javascript to begin with so any guidance will be much appreciated :)My App has two controllers, ClientController and CountryController. In CountryController, I’m retrieving a list of countries from a CountryService that uses the $resource object. This works fine, but I want to be able to share the
-
minitech
jquery jquery-ui angularjs angular
I have the code in my html file<!doctype html> <html ng-app=”slider”> <head><script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js”></script><script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js”></script><script type=”text/javascript” ng:autobind src=”http://code.angularjs.org/0.10.5/angular-0.10.5.min.js”></script><link type=”text/css” href=”
-
jribeiro
javascript html5 angularjs angular javascriptmvc
I’m just starting to mess with angular js and I’m trying to load the data through a post action.I’m using anfularjs v.1.0.2Here is my code: HTML:<!DOCTYPE html> <html ng-app><head><meta charset=”utf-8″><meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″><title></title><meta name=”description” content=””><meta name=”viewport” content=”width=device-width”><script src=”//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js”&
-
spadict
javascript angularjs angular
I have the following code:appModule = angular.module(‘appModule’, []);appModule.factory(‘sharedApplication’, function($rootScope, $http) {var sharedApp;sharedApp = {};sharedApp.currentView = “home-section”;sharedApp.pastEvents = null;$http.get(‘api/highlights’).success(function(response) {return sharedApp.pastEvents = response.data;});return sharedApp; });This code works perfectly and as expected until I try to minify my javascript and then I getError: Unknown provider: eProvider <- eThis is
-
oxirane
angularjs jasmine angular
I am attempting to test an AngularJS controller with a Jasmine unit test spec file. My approach is to use $httpBacked, in the following test:describe(‘SubmissionsController’, function() {var minimal_mock_response = [ { id: 1 } ]; var scope, routeParams, $httpBackend; beforeEach(module(‘submissionServices’));beforeEach(inject(function($_httpBackend_, $rootScope) {scope = $rootScope.$new(); $httpBackend = $_httpBackend_;$httpBackend.expectGET(‘/submissions’).respond(minimal_mock_response);routePa