FAQ Database Discussion Community


how to give maximum selected element in angular js?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
can we give maximum selected element limit in angular ?Actually I have one multiple selected element in which user can select multiple thing .But I need to restrict user In other other user only select 3 items from them .I will tell my problem again I have on button .On...

Can onbeforeunload event be watch by $watch in angular js?

javascript,angularjs,angularjs-directive,angularjs-scope
I am a newbie of angularjs and now I am stack on catching event of onbeforeunload event. I would like to show to some response to user when they leave the page. And I would like to watch onbeforeunload event by $watch and execute my message display function. But how...

AngularJS : Modifiy scope from antoher controller

angularjs,angularjs-scope
I'm starting using Angular JS to build a mobile application with Ionic. I'm trying a thing very simple but it does not work. HTML <div ng-controller="MyCtrl"> Hello, {{name}}! </div> <div ng-controller="MyCtrl2"> Hello, {{name}}! </div> <button ng-controller="MyCtrl" ng-click="MyCtrl.test()">click</button> JS var myApp = angular.module('myApp', []); function MyCtrl($scope) { $scope.name = 'Name 1';...

Why the data is not displayed in view may I use $scope.apply?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am getting data from service and display on view using ng-repeat .Actually I am getting event when user scroll to bottom mean when user reached to bottom I will do something.When It reached to bottom I am changing the contend of my array .I am getting the correct contend...

Angular - unable to get selected ng-repeated radio button using ng-submit

javascript,angularjs,angularjs-scope,angularjs-ng-repeat
I might be missing something really simple here - but if I use ng-repeat to create a bunch of radio buttons - I cannot get the selected one using ng-submit. The controller simply attaches an array of options to the scope. The markup simply creates a bunch of radio buttons...

Reply Textarea for particular post(using textarea), opening for all the comments

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat,ng-repeat
Hi I am trying to implement facebook kind of post and reply comments using angularjs. Below is my code <doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script...

how to give column equal width from total width?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am trying to make example of grid view .I am dynamically generate the table view or grid view .I need column take equal % of width .Example if I have two column they will take 50% with individual .If there is three column then they will take 33.33% individual...

AngularJS Material using $mdDialog in a directive linking function

javascript,angularjs,angularjs-directive,angularjs-scope,angular-material
I am trying to put an Angular Material dialog in a directive's linking function. Conceptually, I'm not seeing why this would not be possible. As per the docs, the $mdDialog.show is on a scope and $mdDialog.hide(); rests in a controller defined by the $mdDialog.show object. I've been able to get...

how to call parent function controller from directive react component angularjs + reactjs?

angularjs,angularjs-directive,angularjs-scope,reactjs
I have angular application and we start using react as render data.we have one problem is how can we call $scope.showUserDetails from directive react component .I tried using this.props.scope.$parent.showUserDetails(); I have Uncaught TypeError: Cannot read property '$parent' of undefined react component /** @jsx React.DOM */ var MYCOMPONENT = React.createClass({ displayName:...

Angular-ui: Is any modal opened?

javascript,angularjs,angularjs-scope,angular-ui
I'm want to launch a code if any modal opens. Commonly I'm want something like: $scope.$watch(function () { return $modal.isOpenState; }, function (val) { //my code here }, true ); But I'm didn't know what to watch. Yes, I can detect open event for each instance, like: modalInstance.opened.then(function() { //my...

Can't access $parent from ng-included controller

angularjs,angularjs-scope,angularjs-ng-include
I'm pretty new to Angular and I'm trying to build an app. I use ng-include to insert my view, depending on the currentURL variable of my main controller. When I try to access the main controller via $parent from the ng-included file, all I get is undefined. My goal is...

how to toggle orderby in angular js

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am trying to show data in ascending and descending on same button click using angularjs .I am able to show data in ascending order .But how I will show descending on same button click (as a toggle in jquery ). I will tell you problem I have button on...

Passing an object to a dynamically created directive

javascript,angularjs,angularjs-directive,angularjs-scope
I'm trying to do something simple, pass an object to a dynamically created directive. In short, I use a button directive which, on click, uses $compile to produce a template containing a directive element. I want to pass an object as this directive's attribute. angular.element(document.getElementById('dirContainer')).append($compile("<my-dynamic-directive name='data.name' data='data'></my-dynamic-directive>")(scope)); fiddle works for...

Confuse about the AngularJS scope when multiple directives share same element

angularjs,angularjs-directive,angularjs-scope
All: I'm new to AngularJS directive scope and I want to know how AngularJS deals with scope when multiple isolated-scope directives are assigned to teh same element. For example: app.controller("main", function($scope){ $scope.data = [ { id:"id_1" }, { id:"id_2" }, { id:"id_3" }, { id:"id_4" } ]; }); app.directive("isodir", function(){...

AngularJS - $scope undefined within same controller

angularjs,angularjs-scope
I have a controller where I am trying to store information in $scope.weather and then use it's contents to pass to a function. When I log the result of $scope.weather[0].latitude when I use it one function but when I call it another function within the same controller the result is...

how to make row collapsible in angular js using ng-repeat?

javascript,angularjs,css3,angularjs-scope,ionic-framework
I am using ng-repeat in my project .I am able to print my objects in row .Actually I want only display element present in dom so I used this plugin https://github.com/kamilkp/angular-vs-repeat My issue is that there is space between rows .I need to remove space between row.I don’t for where...

Angular JS Filter Group Select Filter

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I have a users object similar to the one below: $scope.users = [ { name : 'John Doe', attached_groups = [ {1:object}, {2:object} ] }, { name : 'Bob Doe', attached_groups = [ {3:object}, {4:object} ] } ]; In my HTML I have the following group select. <select id="group_filter"> <option...

How to call function in controller in angularjs?

angularjs,angularjs-scope,angularjs-controller,angularjs-ui-router
If in url parameter id is available then i want to call function. .controller('repeatCtrl', function($scope,$state,$stateParams) { if($stateParams.id != ""){ //Here i want to call itemDetails function $scope.itemDetails(id); }; $scope.itemDetails = function(id) { // function body here!! alert(id); }; }) ...

How to access wrapped variables in a directive?

angularjs,angularjs-directive,angularjs-scope,angular-directive
I have an object which consists of multiple arrays: $scope.myArrays = { array1: ['Pizza', 'Spaghetti'], array2: ['Lasagne', 'Schnitzel'] }; Moreover, I have a custom directive to which I want to pass this object myArrays and bind those arrays to scope variables: <my-directive my-data="myArrays"></my-directive> myApp.directive('myDirective', function() { return { restrict: 'E',...

Directive with transclude, data binding not working in templateUrl

angularjs,angularjs-directive,angularjs-scope,directive
I have a directive with transclude:true. However, the data binding works when i use a template:"" but not when i use templateUrl:"" Below you can find my directive. The rsCarousel.html template contains the same code as the template"" property. When using the template property i get the vm.carouselId on screen...

angularjs 1.3 controller as not working

angularjs,angularjs-scope,angularjs-1.3
I am using one controller on two different part of Page, For that i am using alias of controller using "controller as" syntax. But after upgrading to Angular 1.3.15 it is no longer working.Following is the fiddle to simulate the situation. Working example with 1.2.20 it is not working with...

Angular - TypeError: XX is not a function

javascript,angularjs,angularjs-scope,angularjs-service,angularjs-factory
Maybe I'm missing some kind of property, but I'm follow this project and I'm getting this error in my controller. TypeError: loginService.signin is not a function This is my controller.js angular.module('appcontrollers', []).controller('LoginController', ['$rootScope', '$scope', '$http', '$location', '$localStorage', 'loginService', function ($rootScope, $scope, $http, loginService) { $scope.signin = function() { console.log("username: "...

How to update variables with input values in .less file dynamically using AngularJS

css,angularjs,angularjs-scope,less
I realize a form of this question has been asked before (see 28208451), however, I need to get the input value and then set it as the new value so that other input fields can access it. Here is a link to my plunk. I can enter a new hue...

How to access ng-model value in controller of popup model in angular?

angularjs,angularjs-scope
I want to access ng-model value in controller... But here ng-model is define in popup input field. Model code <ion-modal-view> <ion-header-bar> <h1 class="title">Item Details</h1> </ion-header-bar> <ion-content padding="true"> <form ng-submit="addItem()"> <div class="list list-inset"> <label class="item item-input"> <span class="input-label">Name</span> <input type="text" name="name" ng-model="name"> </label> <label class="item item-input"> <span...

How to make data available in all scopes in Angularjs

javascript,html,angularjs,angularjs-scope,angularjs-service
I wish to fetch data from the server-side using $http and and make it available to the all routes and controllers in my app. Javascript code sample myApp.factory('menuService', function($http){ $http.get('/pages').success(function(data){ return data; //list of pages }); }); myApp.run(function($rootScope, menuService){ $rootScope.menu = menuService; }); HTML code sample <ul > <li ng-repeat="page...

ng-class not working on a custom directive with templateURL

javascript,angularjs,angularjs-scope,angular-directive,ng-class
I have a directive that calls a template. Within the template i am using ng-class which adds a class on click. However, on click, this class is not getting added. Directive: app.directive('myDirective', function () { return { restrict: 'E', scope: { data: "=" }, templateUrl: 'home/user.html' } } ); home/user.html...

how to set dynamically height to element?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am trying to set dynamically height to element in my demo .I will tell you issue I am taking static or constant value of height in my demo .I take 250px constant value #wrapper{ background-image: url(https://dl.dropboxusercontent.com/s/nz1fzunlqzzz7uo/login_bg.png?dl=0); min-height: 250px; background-repeat: no-repeat; } .But I need to add this height dynamically...

why array become blank after splitting into multiple small array?

angularjs,angularjs-directive,angularjs-scope
hello I have one a array $scope.name .I am spliting the array into small arrays .But after spliting the array .it become blank why ? actually I assigned the given array into temp variable and splite the temp variable .Again my $scope.name become blank why ? here is my plunker...

Getting Error in Angular js + Type Script in http put status 400 using DNN7

angularjs,angularjs-scope,typescript,dotnetnuke-7,typescript1.4
I have implememnted a controller using angular js and type script using dot net nuke 7.and trying to call my web api method using http.put but getting error in status as 400. Here is my controller code:- var customerapp = angular.module('CustomerSearch'); module CustomerSearch.controllers { export class CustomerCtrl { static $inject...

how to set font size of toolbar in ionic

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am using toolbar I am able to make toolbar .But I need to customise that toolbar .Actually I am trying to set different font size as default in button and I need to give different width of buttons as default . I have this button bar <div class="button-bar"> <a...

Adding files to $scope in AngularJS controller

angularjs,angularjs-scope,multipartform-data,form-data
I have the following input element:  <div class="form-group">     <label>Attach BOL Document</label>        <input name="file" type="file" class="form-control" onchange="angular.element(this).scope().uploadFile(this.files)" />  </div> In my controller (outside of any function) I set a variable like this: $scope.fd = new FormData(); and I have the following function defined that fires onchange of the input element as...

How to read data inserted in ng-model?

javascript,angularjs,angularjs-scope,ionic-framework,ionic
I am working on ionic framework.I am trying to create a login page.I want to read data inserted in username and pass word fields in login.html.I tried to read using $scope but that didn't work.I tried to use console.log() to print the variables in console but i am getting an...

Angular does not recognize the dynamically loaded page in Extjs

javascript,angularjs,extjs,extjs4,angularjs-scope
I have a SPA in Extjs system. I have also included angular and the necessary modules which i want to use on a page (external html referred in a panel of extjs). Angular is defined in and working everywhere except in newly loaded page.The problem is that i have to...

In Angular, is there a way to communicate imperatively to a directive?

angularjs,angularjs-directive,angularjs-scope
What I know I have a custom directive with isolate scope. From the "outside", I can communicate to the directive using declarative bindings (via @ and = bindings). The directive can communicate to the outside using either declarative bindings (=) or imperative callbacks (&). What I'd like to know Is...

how to show only 25 element at one time?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am trying make table view in ionic using angular js .but I have lot of data to show around 5000 object .So after getting data my UI hang because it is printing the data on dom.So I want to implement lazy loading so that only 100 element is visible...

how to reduce the height of header in tabel view or grid view?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am trying to make simple demo of grid view .In which I have header of title (having gray background) actually I need to reduce the height of title or headers of table which have gray background .can we add alternate color of rows ? please see the given image...

ngDialog scope variables not getting updated

javascript,angularjs,angularjs-scope
I'm new to both AngularJs and ngDialog, and I'm having trouble getting my bindings to work between the ngDialog modal and my controller. I injected the controller's scope into the modal by specifying { scope: $scope }, and I have access to methods defined in the controller, but the bindings...

How to show a hidden tag when clicked on an item

angularjs,angularjs-directive,angularjs-scope
HTML <li ng-class="{class : classVar==='Marketing' }" ng-click="changeClass('Marketing')"> <i class="fa fa-pencil" style="visibility:hidden;"></i> Marketing <i class="fa fa-times" title="Close" style="visibility:hidden;"></i> </li> <li ng-class="{class : classVar==='Sells' }" ng-click="changeClass('Sells')"> <i class="fa fa-pencil" style="visibility:hidden;"></i> Sells Team Nestle <i class="fa fa-times" title="Close" style="visibility:hidden;"></i> </li>...

why after loading more data filter stop working?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
there is one filter functionality in my demo I will explain my problem I have one table in which i use infinite scroll is implemented In other words when user moves to bottom it load more data.There is search input field in top .Using this I am able to filter...

ng-model with isolated scope directive

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I have an isolated directive as an element How can I bind the ngmodel of it since the return html is being overrided ? &lt;div ng-repeat="x in list"&gt; &lt;form-element ng-model="value[x.name]"&gt;&lt;/form-element&gt; &lt;/div&gt; I am having troubles adding the ngmodel to it JS : app.directive('formElement', function($compile) { return { restrict: 'E', scope...

How to grab value of read-only text field and use in angular js result

javascript,angularjs,angularjs-scope
I have a textfield that is read only and pulling it's value from the query string. I can't get the value set in an output of javascript when bound with AngularJS. <input type="text" class="form-control accountNumber" name="accountNumber" id="accountNumber" ng-model="accountNumber" ng-controller="main" data-placement="top" readonly> function main($scope) { var url = window.location.href; var accountId...

how to know which element is selected in angular js

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I make multiple selected popover , in which user can select multiple values . I want to print the all selected value on screen or get a object in which all element which is selected by user .I will explain in other words .In my demo I have one button...

why margin-right is not working in ionic + angular js

javascript,jquery,angularjs,angularjs-directive,angularjs-scope
I am trying to give a margin to a div.But it is taking margin-left but not taking margin right why ?Actually I have scrolling div in which content is scroll I want to give some margin from left as well as from right .So I give margin in % but...

how to use filter on button click in angular js

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat,ionic-framework
could you please tell me how to sort array in ascending or descending order on button click .Actually I have a button on header "V" .using button click I want to display data in ascending order .Actually I am making a grid view in Ionic using angular js .But I...

AngularJS: variable $scope inside a function appears undefined outside the function

javascript,angularjs,inheritance,angularjs-scope
I am new with AngularJS and I am stuck :\ NEED HELP, please! The purpose of the code below is to get a specific data (an integer) from a DB in order to build a doughnut chart. I run the function dataforGraphs() in order to get that value. But then,...

Updating something on angular with an event from another library

javascript,angularjs,angularjs-scope
I am a total noob with angular, but I am trying to understand how to do the following. I am using keycloak and keycloak.js (https://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html/ch08.html) and they have their custom callbacks, like onAuthSuccess. If I want to update something like the login name how should call this onAuthSuccess. Should I...

Different syntax in Angular for controller, services and others

angularjs,angularjs-scope
What is the difference between app.controller("MyCtrl", function($scope, $http){ //... }); and app.controller("MyCtrl", ["$scope", "$http", function($scope, $http){ //... }]); Even though both gives the same result and no error. In fact the first one makes code clean and less to write. Also it is same in services, directive. Can someone give...

resulting HTML from $compile(custom-directive) doesn't bind {{values}}

angularjs,angularjs-directive,angularjs-scope,mapbox,angularjs-compile
I want to dynamically add Angular custom Directives, but the directive resulting from $compile(directive) doesn't have the 2-ways binding. Here's my simplified problem: I am using MapBox, and I want to use Directives for the the markers' popup to show, for example, the markers' title. MapBox wants HTML as a...

In Angularjs, how to update table data after deleting a row from it

angularjs,angularjs-scope,angularjs-ng-repeat
I am using the angularjs to call Asp.net Web API. After I delete a row from the table? I also did not find the solution in w3schools. My HTML code <tr ng-repeat="user in users | filter: search"> <td>{{ user.Id }}</td> <td>{{ user.FullName }}</td> <td>{{ user.Mobile }}</td> <td>{{ user.Birthdate }}</td> <td>{{...

How to add new key in existing array in angular js?

javascript,arrays,angularjs,angularjs-scope
I have define blank array $scope.order, ON form submit data get and create new array then merge with existing array. .controller('GuestDetailsCtrl',function($scope){ $scope.order = []; $scope.itemDetails = function() { // Here data get after form submiti have array arrieve from form submit. $scope.order=$scope.order.push({name:$scope.item.name,price:$scope.item.price}); } }); I want result like this. $scope.order...

Uncaught ReferenceError: angular is not defined using type script

angularjs,angularjs-scope,typescript,typescript1.4,typescript1.5
I am working with Type Script and Angular js I have implemented a Controller which names as quick search and from that i am trying to perform search opeartions .I which i am getting the search term in a text box from my aspx and than on ng click it...

Passing data to newly created directive in angularjs when ajax call is over

ajax,angularjs,angularjs-directive,angularjs-scope,slickgrid
I am trying to create custom directive out of slick grid. This is what I have done so far. angular.module('app') .directive('myGrid',function () { return { restrict: 'E', link: function (scope, el, attrs) { var data = []; var columns = [ {id: "title", name: "Title", field: "title", width: 160, cssClass:...

ng-click value change + $scope.watch bind not working properly

javascript,angularjs,angularjs-scope,angularjs-ng-click,angularjs-watch
I have a scope variable '$scope.searchType' which is equal to 'createdAt' by default. In my HTML I have options that change the scope variable value: <ul class="dropdown-menu" role="menu"> <li><a ng-click="searchType = 'Anything'">Anything</a></li> <li><a ng-click="searchType = 'Payment'">Payment</a></li> <li><a ng-click="searchType = 'Total'">Total</a></li> <li><a ng-click="searchType = 'Tax'">Tax</a></li> <li><a...

Unable to boradcast event from parent controller in angularjs

angularjs,angularjs-scope,angularjs-routing,angularjs-controller
I have a two controller having parent-child relationship: This is the route for parent controller: angular.module('app') .config(function ($stateProvider) { $stateProvider .state('data-show', { url: '/data', templateUrl: 'app/data.html', controller: 'DataCtrl' }); }); This is the HTML for parent controller: <div class="block-header"> ... ... <div ng-include="'components/child_page.html'"></div> </div> Code for parent controller: angular.module('app') .controller('DataCtrl',...

How do I get an input value into Angular's $scope?

javascript,angularjs,angularjs-scope,angularjs-ng-model
I'm new to Angular, and I am trying to do something really basic. Here is a part of a view (all angular files are added elsewhere) : <div ng-controller='ctrl'> <input type='text' ng-model='id'> </div> And here is my controller : module.controller('ctrl',['$scope', function ($scope) { // get the scope value here }]);...

ngClass not updating the class

javascript,angularjs,twitter-bootstrap,angularjs-scope,ng-class
I am using angularJS with bootstrap to design a navigation on my application. I have defined a main controller and inside the main controller I call different page views using the ng-view attribute and then these individual views have their own controllers. I am using the ng-class attribute to add...

AngularJS access JSON index values dynamically

angularjs,multidimensional-array,angularjs-scope,angularjs-ng-repeat
My scope data: $scope.data = "category": [{ "name": "cat1", "behaviour": "normal", "selected": 0, "values": [{ "label": "define", "count": 6 }] }, { "name": "cat2", "behaviour": "normal", "selected": 0, "values": [{ "label": "type", "count": 6 }] }, { "name": "Company", "behaviour": "multi-select", "selected": 0, "values": [{ "label": "VW", "count": 4 },...

Angular ng-if for checking empty string not working

javascript,html,angularjs,angularjs-scope
In my view, I have the below code to display some data from angular scope variables. The first two lines work fine. They display data from the scope variables but the line from ng-if does not display. What is wrong with my ng-if condition? <div ng-controller="PaymentCtrl"> <h3>Payment successfully posted {{PaymentID}}</h3>...

Directive displaying Error: [$parse:lexerr] after moving template to templateURL

angularjs,angularjs-scope,angularjs-ng-repeat,ng-repeat,angular-directive
I have a directive working without any issues when the HTML markup is written in the template section of the directive. I've just moved the HTML markup in a .html file and on load of the page, i am seeing: Error: [$parse:lexerr] http://errors.angularjs.org/1.3.14/$parse/lexerr?p0=Unexpected%20next%20character%20&p1=s%2016-16%20%5B%5C%5D&p2=option.name%20%3D%3D%3D%20%5C'choices%5C' Original directive: app.directive('myDirective', function () { return...

why ngrepeat not working properly not display data?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am making a simple demo of nested ng-repeat with some condition.it is not printing any values why ? Actually I am trying to get below result after iteration of two objects Expected result ght nor abc pqr code pen or plunker \ <ion-scroll scrollbar-y="true"> <div class="row rowclass" ng-repeat="column in...

custom directive parameters declaration differences

angularjs,angularjs-directive,angularjs-scope
I am wondering about the differences between declaring custom directive parameters in these three ways : js : app.directive('customDirective', function() { return { restrict: 'E', scope : { x : '=', y : '=y', z : '=?' } , } }); I am monitoring the three seems same behavior. Can...

how to add active class in ionic + angular?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
could you please tell me how to add active class in selected button .when use select any button from toolbar it become green and show data .Actually I have four button and four div contend .I need to show div contend when I select the button .In other words when...

How to set background colour when click on an item?

angularjs,angularjs-directive,angularjs-scope
HTML <ul class="ul_nav"> <li ng-class="class" ng-click="changeClass()">Marketing</li> <li ng-class="class" ng-click="changeClass()">Sells Team Nestle</li> <li ng-class="class" ng-click="changeClass()">Marketing Test</li> <li ng-class="class" ng-click="changeClass()">Marketing </li> </ul> Angularjs $scope.changeClass = function(){ if ($scope.class === "nav_color") $scope.class = "nav_active"; else $scope.class = "nav_color"; }; CSS .ul_nav{ margin-top:15px; list-style:none;...

In AngularJS, why should I use a $ at the beginning of a scope object name?

angularjs,angularjs-scope
No JS experience. Learning AngularJS So I've read https://docs.angularjs.org/guide/scope, and I've looked at some stackoverflow.com answers on what the $ is used for in JavaScript. I understand the $ has a specific use in some libraries, like JQuery, and that in newer versions of JavaScript it is just seen as...

Angular scope not affecting ng-show as expected

javascript,angularjs,angularjs-scope
I have a question about Angular.js scope. Firstly I am very new to Angular and I have read the scope documentation and tried to understand it the best I can. I have a feeling my question is similar to this: ng-show not binding as expected However my example is simpler...

AngularJS variable not getting defined

angularjs,angularjs-scope
In my controller I am defining a variable for eg., $scope.example.example2 = true. But when the page loads the controller doesnt work.(for eg.,there are four div which are dependent on a variable(ng-show), but they become visible irrespective of the variable). As soon as I remove $scope.example.example2 from the controller, everything...

how to show alert when user scroll to top of div in angular js?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
hello could you please how to show alert when scroll to top of div in angular js and same in when user scroll to bottom .Actually I know How to achieve this in jquery using if(this.scrollTop===0).But I am using ionic framework with angular js .So could could you please tell...

Why can't I set the height of an element with ng-style?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am trying to add dynamically set the height of a div, but it is not successfully being set. I get the height of window and divide it by 3, but it is not working. Here is where I set the height: <div id="wrapper" ng-style="height :hgt+'px'"> I am setting the...

$scope variable does not update within $interval function

javascript,angularjs,angularjs-scope
I am using $interval for my custom stopwatch. Within the $interval function I have a variable $scope.inputValue which is binded to a range. The problem is that after each iteration of $interval (every 500ms), the most recent $scope.inputValue is not taken into account, but only the value at the initialization...

Calling additional service functions after a resolved promise in Angular

javascript,angularjs,angularjs-scope,angularjs-service,angularjs-promise
In Angular I have a service to access the google contacts api, then store all my contacts into variable (StorageVar) to be analyzed by other functions in the service. Should I call one of the analysis functions before getting the data from the API, I want to call the getAPI...

Apply $compile and $scope to external div text moved into ng-view element

javascript,angularjs,angularjs-scope
I have a div element that I attach to one of the elements within an ng-view DOM tree. The div contains text elements which I'd like to have evaluated within the current $scope of the ng-view tree. How do I get Angular to re-evaluate the attached element within that scope?...

Capturing scope in directive while it's digesting—far more verbose than a console.log(scope)

javascript,angularjs,angularjs-directive,angularjs-scope
I've been using a directive with scope: false to investigate what's available to a directive that has access to its parent's scope—I just now realized that doing a console.log(scope) in the linking function has been somewhat misleading. .directive('directive', function() { return { scope: false; link: function (scope, elem, attrs) {...

Get model value from Bootstrap tab under if condition

javascript,angularjs,angularjs-scope,angular-bootstrap
I am facing problem in making two way binding to a form model inside the tabs which is under ng-if condition. Plunker link to my problem is http://plnkr.co/edit/F5h8eCu7IlXlwi1XhdV7?p=preview I have tried all ways possible but the scope variables aren't recognized under the tabset. The scope variables are accessed in "ng-if"...

angularjs $parse string to a “controller as” method

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
How do I parse foo.callbacke to point to timerController.callbacke method? <div ng-app="timerApp" ng-controller="timerController as foo"> <div ng-repeat="item in [1,2,3,4]"> <div watcher="{'seconds': 'foo.callbacke'}"> {{seconds}} </div> </div> If you prefer: http://jsfiddle.net/e86e05a1/ (open console)...

Angular Directive scope undefined

angularjs,angularjs-directive,angularjs-scope
I'm using a directive to parse a xls file and pass the data to a button via scope. The problem is that within the link function I'm binding to the element change event and calling a function that parses the xls file, but scope is undefined within the handleFile function,...

how to open view on button click in angular +ionic?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
could you please tell me how to open views on button click in ionic.Actually I have three buttons and three views .I want to show one view at one time .like when I click Breakfast it show Breakfast.html page .when I click lunch it show lunch.html same as dinner .I...

How to get column footer data in Angular UI-Grid?

javascript,angularjs,angularjs-directive,angularjs-scope,angular-ui-grid
For example, in this tutorial, if there is any way to get the data in the column footer? I'd like to present the total numbers in somewhere else. Thanks in advance....

Angular $routeProvider and Controller As Syntax

angularjs,routing,angularjs-scope,angularjs-routing,ngroute
Can anyone tell me if it is valid to use $routeProvider with Controller as syntax? I am having issues accessing <h1>{{kickController.foo}}</h1> from the controller where this.foo resides. angular.module('ucp.kick', ['ngRoute']).config(function($routeProvider, APP_BASE_URL) { return $routeProvider.when(APP_BASE_URL + 'kicks', { reloadOnSearch: false, navitem: true, name: 'Kicks', templateUrl: 'kick/partials/kick.html', controller: 'kick as KickController' }); });...

Directive scope variable

javascript,angularjs,scope,angularjs-scope
I am using a directive for three consecutive time in html page, the scope variable i am passing to different at every time but it is taking all the scope variable from the third directive ?, for example first time, <my-dir is-active=true></my-dir> sec time, <my-dir is-active="true"></my-dir> third time, <my-dir is-Active="true"...

Targeting $index from ng-repeat

angularjs,controller,angularjs-scope
How would I go about targeting this model in the controller? formData[$index].ID This is not working - $scope.getJob = function() { Employee.get({id: "" + $scope.formData[$index].ID}, function (data) { console.log(data); }) } ...

how to insert property in all objects?

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am trying to add properties in all object which is present in array.I will explain more in other words I have array of objects .I need to add “selected” property in all object .The value of “selected” property is true for first two object and for rest element it...

Angular Controller As Syntax-no method '$watchCollection'

angularjs,angularjs-scope
I am trying to do Controller As Syntax in Angular. At this point, I have it in my routerProvider...not sure if it would matter for the issue I am having, but here it is anyways: angular.module('ucp.kick', [ 'ngRoute' ]) .config ($routeProvider, APP_BASE_URL) -> $routeProvider .when APP_BASE_URL + 'kicks', name: 'Kicks'...

angularJS update table model on form submit

angularjs,laravel,angularjs-scope
I'm new to angular, currently having a problem with updating a table data on form submit. This is my view: <div class="container-fluid"> <div class="row"> <div class="col-md-12" ng-controller="feeStatement"> <panel panel-class="panel-sky" heading="Add Fee Details"> <panel-controls> <panel-control-collapse></panel-control-collapse> </panel-controls> <div id="alert" class="alert alert-danger hide"> <strong>Error</strong> Unable to save the course data.<br><br>...

Pass variable from directive to controller

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-controller
I have this directive definition and want to pass currentScriptPath to the TestController. How do I do that? (function(currentScriptPath){ angular.module('app', []) .directive('test', function () { return { restrict: 'E', scope: {}, templateUrl: currentScriptPath.replace('.js', '.html'), replace: true, controller: TestController, controllerAs: 'vm', bindToController: true }; }); })( (function () { var scripts...

AngularJS nav active class won't show

javascript,angularjs,angularjs-directive,angularjs-scope
I'm Quite new to AngularJS and I try to develop a nav bar, which changes the activeclass. So I tried to make a function in my controller to define the active class. My html code of the nav: The controller: I compiled with grunt and there are no errors/warnings. Every...

how to make rounded input field in ionic?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am able to make input field with icon but I need the input field should be rounded corner ![enter image description here][1] and horizontally center width smaller as show in image . please check the below image Please check my search bar is smaller in width and horizontally centered...

why checkbox is display in angular js?

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am trying to make a simple demo of a multiple select option. I also have a limit in my demo. In other words, a user can only select two items. I am able to do that but when a user selects a third one, a checkbox is selected for...

Getting data from a web service with Angular.js

angularjs,angularjs-scope,angular-http
Im trying to get data in a Json format from a remote WS using Angular and im having some trouble. The data comes from the web service correctly but i cant use it inside the controller. Why is that? Angular Code: var booksJson; var app = angular.module('booksInventoryApp',[]); // get data...

Binding issue in AngularJS

javascript,angularjs,angularjs-scope,angularjs-controller,angularjs-controlleras
I am trying to bind from a http get request. The http get is returning true or false. I have tested the get and it is returning properly. When I run the code below, it shows the alert(1111) properly also. However, when I'm trying to change the button text, nothing...

How to hide values from client in Angularjs

javascript,angularjs,angularjs-scope,angular-ui-router
Hi I'm very beginner on Angularjs and I'm trying to build basic login application. I want to hide some values from client like api url, api keys but i couldn't find a way to do it. I also want to modify my directive via controller to change view if user...

ng-switch is not working as expected

angularjs,angularjs-directive,angularjs-scope,ng-switch
Maybe the use of the 2-ways binding and $watch is still not very clear to me.. but I was expecting that this piece of code should work! I have a topNavbar directive in my index.html page. The topNavbar should show the loginButton if the user is not logged, otherwise a...

Limiting $scope in AngularJS

javascript,angularjs,angularjs-directive,angularjs-scope
I have a multi-page AngularJS web application that serves as an analytics dashboard. I am currently using $scope to create variables so I can display some of the data dynamically on the HTML pages. Instead of creating $scope variables that will be global no matter what page a user is...

How to remove circle on background of checkbox?

angularjs,angularjs-directive,angularjs-scope,ionic-framework,ionic
I am trying to show a check-box in a popup screen. Actually my checkbox is rounded. I need no rounded background and tick should be green as show in image. I need checkbox will be placed on right side and having no background but have green color. Here is my...

angular directly send $scope parameter from view to service or factory

angularjs,angularjs-scope,angularjs-factory
I have a factory and need to call factory from view. i want to call factory with two parameters. Is it possible to send $scope from template? Because, i am using same factory for multiple places. <input name="accnum" ng-blur="myservice.getAccountDetailsToDisplay($scope, accno)" /> controller, $scope.myservice= getAllDetailsService; In service, tellerApp.factory('getAllDetailsService',['$rootScope', '$resource', '$http', '$filter',...

AngularJS Set Value to $scope from Nested Function

javascript,angularjs,scope,angularjs-scope,closures
I'm trying to get a value from a function inside a function: Controller $scope.vm = {}; function myFunc(){ $scope.vm.hello = 'Hello'; function myFunction(){ $scope.vm.world = 'world'; } } myFunc(); View <p>{{vm.hello}} {{vm.world}}</p> Here's my Plunk. How can I get this to display "Hello world"?...

How to create dynamically $scope variable and function in angular JS

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I trying to creating dynamically $scope variable and function and call to ng-click directive. My scenario is call dynamically function in ng-repeat & ng-click. Json { "listnames": [ { name: rock, age: 24, year: 1999}, { name: rock1, age: 24, year: 1999}, { name: rock2, age: 24, year: 1999}, {...

how to display sorted only 25 element in infinite scroll?

javascript,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat
I am using infinite scroll in my demo ,In which I am showing only 25 element first time .When user scroll down to bottom it load more data and display that more data .It is do repeat steps if user want whole data to display (scroll to bottom load more...

Accessing parent Controllers scope within a directive that uses ControllerAs and scope:true

angularjs,angularjs-directive,angularjs-scope
I'm trying to use ControllerAs in a directive with no $scope injection, using this instead, and I'm struggling when scope:true When I use an isolated scope everything works fine because I can use bindToController: true, but in this case I'm missing something and I don´t know what. I have this...

angularjs- calling method of one controller in another

javascript,angularjs,twitter-bootstrap,angularjs-scope
Hi I am working on a project where I have a button for subscribe/unsubscribe notification.I am using bootstrap modal on this button click and if user selects ok I perform the required operation.Everything is working fine just in the end in order to refresh my list I need to call...

Access parent property from directive controller with ControllerAs syntax and no $scope injection

angularjs,angularjs-directive,angularjs-scope
This is a followed up question from this. How can I access a property defined in MyController from MyDirectiveController to change its value or just read it and use it for something else? (commented line in the code). angular .module("app",[]) .controller('MyController', MyController) .controller('MyDirectiveController', MyController) .directive('myDirective', myDirective); function MyController() { var...