Search Results

Search found 1117 results on 45 pages for 'angularjs directive'.

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

  • Upcoming Enhancements in AngularJS Integration in NetBeans IDE

    - by Geertjan
    New bleeding edge enhancements in AngularJS support in NetBeans IDE enable many more controllers to be found than in NetBeans IDE 7.4. The next version of NetBeans IDE parses all JavaScript files and checks for defined AngularJS controllers, such as the below: All recognized AngularJS controllers are offered in code completion, as shown below. In other words, code completion works better in finding AngularJS controllers. Another improvement is in the "Go To Declaration" feature. When you click Ctrl+Mouse over the name of a controller inside an NG-controller directive, you will be navigated to the related controller declaration. More accurate results can be shown in code completion mainly because there are changes in the generation of JavaScript virtual sources in an AngularJS page.

    Read the article

  • DurandalJS vs AngularJS?

    - by Zach
    I'm looking for a JS framework to build an SPA and found DurandalJS and AngularJS. Can anyone compare these two frameworks? I did find many articles that compares AngularJS and KnockoutJS, and they say AngularJS is more than data binding, so I think DurandalJS may be the one to compare. I did a little research on AngularJS, it is good but one thing is bad: the $ prefix does not work when minified, although there is an ugly workaround. And someone said Twitter Bootstrap does not work well with it (I didn't check). For DurandalJS, I still cannot find the samples (http://durandaljs.com/documentation/Understanding-the-Samples/), so it's hard to say. PS: are they working well with TypeScript? Best regards, Zach

    Read the article

  • Is there any convenient way to check if a DOM element is `$compile`d in AngularJS?

    - by Tong Shen
    I'm trying to integrate some plain JavaScript library with AngularJS, in which I need to manually $compile some DOM elements. I'm doing the compilation like this: $compile(e.srcElement)($scope); e.srcElement is the DOM element I want to $compile. I wonder, if there is any established way to check if a given DOM element has been compiled. I know it's possible if I attach some data attributes to the DOM during compiling, and try to retrieve that later. What I want to know is if there is any existing method in AngularJS. Thank you!

    Read the article

  • How do I use angularjs directives in generated d3 html?

    - by zlog
    I'm trying to use the angularjs tooltip directive on my d3 visualisation, so I have something like var node = svg.selectAll(".node") .data(nodes) .enter().append("circle") .attr("tooltip-append-to-body", true) .attr("tooltip", function(d) { return d.name; }) // ... attributes However, the tooltips are not showing. Do I need to $compile or something? I've tried wrapping it around $timeout too, but that didn't work.

    Read the article

  • Chrome Apps Office Hours: TextDrive and AngularJS

    Chrome Apps Office Hours: TextDrive and AngularJS Ask and vote for questions: goo.gl In this episode, the AngularJS team joins us to talk about how they used Angular to build TextDrive. TextDrive is an open source text editor application that demonstrates of the power and simplicity of AngularJS and Chrome Apps. It features integration with Google Drive, web intents, and Ace (ace.ajax.org) in a simple and clean interface built upon HTML5 and web standards. To learn more visit github.com From: GoogleDevelopers Views: 0 0 ratings Time: 00:00 More in Science & Technology

    Read the article

  • What parts of functionality should be refactored into a directive?

    - by Sprottenwels
    I am creating an application from legacy code using AngularJS. I wonder what parts of my code should be moved into a directive. For example, iI had thought of moving a table which is used multiple times across the application into a directive. The tables alter from headings and size. Is it worth the effort or even a good practice to turn such things into their own directives or should I create each table in a unique way?

    Read the article

  • Mostly PJAX site with some AngularJS

    - by jrhicks
    I have a site using PJAX all over the place and I have a few pages that are using AngularJS. For the AngularJS pages I would like to continue to use PJAX to get all the benefits associated with not reloading the entire HTML page, assets etc. Unfortunately, PJAX just loads some HTML into the page and doesn't fire any javascript. This is okay, because I can fire the javascript manually on pjax success, but I can't quite figure out what makes AngularJS initialize. For a simple scenario, lets say I AJAX the following HTML into a page. Also assume, the page already had Angular.js included. What could I call to have the following behave like an Angular App? <div> <label>Name:</label> <input type="text" ng-model="yourName" placeholder="Enter a name here"> <hr> <h1>Hello {{yourName}}!</h1> </div> Thanks

    Read the article

  • Angularjs throws TypeError: Cannot read property 'indexOf' of undefined

    - by Ali
    I'm trying to debug the above code which I feel like this is very useful .< I can't even find what is wrong in my code and don't really know where to start since Angularjs still very new to me. I'm trying to localize Angularjs app. I know this is missing a lot of context in order to get a help, but I'm trying to see what information that I should give that would help on this debugging. I've gone through any indexOf in angularjs file and I can see few things is undefined but don't know if that would be helpful. So I've traced the problem here and this is what I have figured is the problem, but still counldn't figure out why... config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider.when('/:locale?/:username/badges', { templateUrl: '_partials/badges.html', controller: 'badges' }) .when('/:username/badges', { templateUrl: '_partials/badges.html', controller: 'badges' }) .when('/:username/teaching-resources', { templateUrl: '_partials/teaching-resources.html', controller: 'teachingResources' }) .when('/:username/makes', { templateUrl: '_partials/makes.html', controller: 'makes' }) .when('/:username/likes', { templateUrl: '_partials/likes.html', controller: 'likes' }) .when('/:username/events', { templateUrl: '_partials/events.html', controller: 'events' }) .when('/:username', { templateUrl: '_partials/badges.html', controller: 'badges' }); $routeProvider.otherwise({ redirectTo: '/error/404' }); The URL that I'm visiting for default page is: This will fail and throw the error. http://localhost:1969/en-US/user/someUserName This will work fine http://localhost:1969/user/someUserName UPDATE I figured out! This is the problem: $locationProvider.html5Mode(true); But why!?

    Read the article

  • AngularJS Bind Attribute Presence

    - by Chuck
    I want to bind the presence of an attribute to a variable in AngularJS. Specifically, sandbox for an iframe. Say I have $myCtrl.allowJavascript as a variable, I want to do: <iframe src="..." sandbox /> Where the sandbox attribute is present when allowJavascript == false, and I want the sandbox attribute to disappear when allowJavascript == true. Does AngularJS have a mechanism for this? The closest thing I could find was here, which basically says "it will just work for certain attributes"--but not for sandbox.

    Read the article

  • I'm new on Angularjs and i have this error ReferenceError: _ is not defined at h.$scope.setSelectedClient?

    - by user3381078
    Here is my controller.js . var animateApp = angular.module('animateApp'); animateApp.controller('portofolioController', ['$scope', function ($scope) { $scope.selectedCategory = []; $scope.categoryList = [{ id: 1, name: 'webdesign' }, { id: 2, name: 'webdevelop' }, { id: 3, name: 'logo' }]; $scope.clients = [{ name: '1', designation: 'descriere', category: { id: 1, name: 'webdesign' } }, { name: '2', designation: 'descriere', category: { id: 2, name: 'wendevelop' } }, { name: '3', designation: 'descriere', category: { id: 3, name: 'logo' } }, { name: '4', designation: 'descriere', category: { id: 4, name: 'webdesign' } }, { name: '5', designation: 'descriere', category: { id: 5, name: 'webdevelop' } }]; $scope.setSelectedClient = function () { var id = this.category.id; if (_.contains($scope.selectedCategory, id)) { $scope.selectedCategory = _.without($scope.selectedCategory, id); } else { $scope.selectedCategory.push(id); } return false; }; }]); And this is in my html file, is a button and when it pressed, the list i have is sort by category. I have a filter in filter.js who show just the fields in this category. <li data-ng-repeat="category in categoryList"> <a data-ng-click="setSelectedClient()" class="btn">{{category.name}}</a></li> I'm receving an error when i click on click on button. I'm looking posts like that but i can't find anything. ReferenceError: _ is not defined at h.$scope.setSelectedClient (http://localhost/Portofolio2/js/controllers.js:60:13)

    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

  • dynamic directives in angularjs

    - by user28061
    The directive's attributes don't change when the scope is updated, they still keep the initial value. What am I missing here? HTML <ul class="nav nav-pills nav-stacked" navlist> <navelem href="#!/notworking/{{foo}}"></navelem> <navelem href="#!/working">works great</navelem> </ul> <p>works: {{foo}}</p> Javascript (based on angular tabs example on front-page) angular.module('myApp.directives', []). directive('navlist', function() { return { scope: {}, controller: function ($scope) { var panes = $scope.panes = []; this.select = function(pane) { angular.forEach(panes, function(pane) { pane.selected = false; }); pane.selected = true; } this.addPane = function(pane) { if (panes.length == 0) this.select(pane); panes.push(pane); } } } }). directive('navelem', function() { return { require: '^navlist', restrict: 'E', replace: true, transclude: true, scope: { href: '@href' }, link: function(scope, element, attrs, tabsCtrl) { tabsCtrl.addPane(scope); scope.select = tabsCtrl.select; }, template: '<li ng-class="{active: selected}" ng-click="select(this)"><a href="{{href}}" ng-transclude></a></li>' }; });

    Read the article

  • how to write right click event for selected row in ng-grid using angularjs

    - by user3819122
    i am using angularjs to write click event for selected row from ng-grid.but i want to write right click event for selected row from ng-grid in angularjs.below is my sample code for click event for selected row in ng-grid. Sample.html: <html> <body> <div ng-controller="tableController"> <div class="gridStyle" ng-grid="gridOptions"></div> </div> </body> </html> Sample.js: app.controller('tableController', function($scope) { $scope.myData = [{ name: "Moroni", age: 50 }, { name: "Tiancum", age: 43 }, { name: "Jacob", age: 27 }, { name: "Nephi", age: 29 }, { name: "Enos", age: 34 }]; $scope.gridOptions = { data: 'myData', enableRowSelection: true, columnDefs: [{ field: 'name', displayName: 'Name', cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>' }, { field: 'age', displayName: 'Age', cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>' } ] }; $scope.foo = function() { alert('select'); } }); please suggest me how to do this.

    Read the article

  • How to detect that cookies are disabled in browser with AngularJS

    - by user2943082
    I use an AngularJS in my current project and try to implement feature which detects does cookies are disable in browser. I have tried to use an AngularJS module "ngCookies" for resolve this issue. The main idea of this feature is to try to create some cookie, then check does this cookie was created and show message if it wasn't. But it didn't worked. Controller: someProject.controller('CookieCtrl', ['$scope', '$cookieStore', function($scope, $cookieStore) { $scope.areCookiesEnabled = false; $cookieStore.put("TestCookie", "TestCookieText"); $scope.cookieValue = $cookieStore.get("TestCookie"); if ($scope.someValue) { $cookieStore.remove("TestCookie"); $scope.areCookiesEnabled = true; } }]); View: <div class="main" data-ng-controller="CookieCtrl"> <div class="warning_message" data-ng-show="!areCookiesEnabled"> <span data-ng-bind="areCookiesEnabled"></span> </div> </div> Can anybody tell me where is my mistake?

    Read the article

  • Why ng-hide don't work with custom directives?

    - by javier
    I'm reading the directives section of the developers guide on angularjs.org to refresh my knowledge and gain some insights and I was trying to run one of the examples but the directive ng-hide is not working on a custom directive. Here the jsfiddle: http://jsfiddle.net/D3Nsk/: <my-dialog ng-hide="dialogIsHidden" on-close="hideDialog()"> Does Not Work Here!!! </my-dialog> <div ng-hide="dialogIsHidden"> It works Here. </div> Any idea on why this is happening? Thanks. solution Seems that the variable dialogIsHidden on the tag already make a reference to a scope variable inside the directive and not to the variable in the controller; given that the directive has it's own insolated scope, to make this work it's necesary to pass by reference the variable dialogIsHidden of the controller to the directive. Here the jsfiddle: http://jsfiddle.net/h7xvA/ changes at: <my-dialog ng-hide="dialogIsHidden" on-close="hideDialog()" dialog-is-hidden='dialogIsHidden'> and: scope: { 'close': '&onClose', 'dialogIsHidden': '=' },

    Read the article

  • Unit-testing a directive with isolated scope and bidirectional value

    - by unludo
    I want to unit test a directive which looks like this: angular.module('myApp', []) .directive('myTest', function () { return { restrict: 'E', scope: { message: '='}, replace: true, template: '<div ng-if="message"><p>{{message}}</p></div>', link: function (scope, element, attrs) { } }; }); Here is my failing test: describe('myTest directive:', function () { var scope, compile, validHTML; validHTML = '<my-test message="message"></my-test>'; beforeEach(module('myApp')); beforeEach(inject(function($compile, $rootScope){ scope = $rootScope.$new(); compile = $compile; })); function create() { var elem, compiledElem; elem = angular.element(validHTML); compiledElem = compile(elem)(scope); scope.$digest(); return compiledElem; } it('should have a scope on root element', function () { scope.message = 'not empty'; var el = create(); console.log(el.text()); expect(el.text()).toBeDefined(); expect(el.text()).not.toBe(''); }); }); Can you spot why it's failing? The corresponding jsFiddle Thanks :)

    Read the article

  • 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

  • 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

  • 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

  • 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

  • AngularJS recursive directive with a dynamic HTML template (bounty)

    - by Nazar Sobchuk
    I have a realy hard task here. I am working on an AngularJS web app, which is capable of sending different HTTP methods to our project's Restful Web Service and receiving responses in JSON. Basicaly it looks like this: You can create some REST resource from this application. Let's say an exam. To create an exam - you pick a resource from a list of available resources. This triggers a function, that sends a request to localhost:8080/STEP/api/explain/resorceName and gets a description for this resource. Description looks like this: http://jsonblob.com/534fc022e4b0bb44248d6460 After receiving a response - I start building input fields like follows (allFields - array of field objects for this resource, enumValues - enum values for resource's field if it's property isEnum = true): <div ng-repeat="field in allFields"> <div ng-show={{!field.isEnum}}> <p ng-show={{field.isRequired}}>{{field.name}}*: </p> <p ng-show={{!field.isRequired}}>{{field.name}}: </p> <input type="text" ng-model="updateEntityResource[field.name]" ng-change="getUpdateEntityAsText()" class="form-control" placeholder="{{parseClassName(field.type)}}"> </div> <div ng-show={{field.isEnum}}> <p ng-show={{field.isRequired}}>{{field.name}}*: </p> <p ng-show={{!field.isRequired}}>{{field.name}}: </p> <select ng-model="updateEntityResource[field.name]" ng-change="getUpdateEntityAsText()" class="form-control"> <option></option> <option ng-repeat="enumValue in field.enumValues" label={{enumValue.name}}>{{enumValue.ordinal}}</option> </select> </div> </div> Now, the problem. I need to create a recursive directive, which would be capable of generating fields in such maner as described above for every resource's field that has "restResourceName" not null. To get all it's fields you just send a request to localhost:8080/STEP/api/explain/restResourceName and get similar JSON response as shown above, which is then used to build HTML elements for inputing values into model. Does anyone know how this can be achieved using angular recursive directive? Every useful answer is highly appreciated and evaluated. The correct answer will get +50 or I will start a bounty, because I'm realy stuck with this for 2 days. If you need any additional info - let me know. Thank you.

    Read the article

  • AngularJS not validating email field in form

    - by idipous
    I have the html below where I have a form that I want to submit to the AngularJS Controller. <div class="newsletter color-1" id="subscribe" data-ng-controller="RegisterController"> <form name="registerForm"> <div class="col-md-6"> <input type="email" placeholder="[email protected]" data-ng-model="userEmail" required class="subscribe"> </div> <div class="col-md-2"> <button data-ng-click="register()" class="btn btn-primary pull-right btn-block">Subsbcribe</button> </div> </form> </div> And the controller is below app.controller('RegisterController', function ($scope,dataFactory) { $scope.users = dataFactory.getUsers(); $scope.register = function () { var userEmail = $scope.userEmail; dataFactory.insertUser(userEmail); $scope.userEmail = null; $scope.ThankYou = "Thank You!"; } }); The problem is that no validation is taking place when I click the button. It is always routed to the controller although I do not supply a correct email. So every time I click the button I get the {{ThankYou}} variable displayed. Maybe I do not understand something.

    Read the article

  • AngularJS Templates run twice

    - by Curt
    I'm working on an AngularJS web app with Twitter Bootstrap. The templates run twice. I don't know why they do this. Below is some of the code in the index.html file: <html data-ng-app="app" ng-controller="AppCtrl"> <div class="container ng-view" data-ng-view></div> ... <script> (function (angular) { "use strict"; // jshint ;_; // http://coenraets.org/blog/2012/02/sample-application-with-angular-js/ angular.module('app', ['filters', 'angular', 'currency']) .config(function($routeProvider) { var _view_ = 'view/'; $routeProvider. when('/app', {templateUrl:_view_+'app/index.html', }). when('/account/settings', {templateUrl:_view_+'app/settings.html', }). when('/profile/:profile_ID', {templateUrl:_view_+'app/profile.html', controller:ProfilePageCtrl}). when('/discuss', {templateUrl:_view_+'discuss/discuss.html', controller:DiscussCtrl}). when('/', {templateUrl:_view_+'page/home.html' }). when('/:page', {templateUrl:_view_+'page.html', controller:PageCtrl}). otherwise({redirectTo:'/'}); }) ... Can anybody provide suggestions? Are the templates supposed to run twice? 2012-12-04 Update: I found out that the templates are running twice, not the controller.

    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 reference filtered ng-repeat items from a controller in AngularJS

    - by ParkerDigital
    I have some JSON data that is rendered out via the ng-repeat directive, and the results are then filtered via some checkboxes/drop-downs, and some custom filter functions in my controller. I now want to add a function to my controller that is triggered by an 'ng-change' on some of the checkboxes, that can reference the current list of items in my 'ng-repeat'. I realise I can reference these values from a custom filter, for example $scope.filterProvider = function(item), but this function is then called for each and every item in the ng-repeat, which isn't what I want - I want the function to just be called each time a checkbox is checked/unchecked, and I need that function to be able to reference the items in my ng-repeat...does that make sense to anyone?! And if so, does anyone know how I can do that? Thanks :-)

    Read the article

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