angularjs-directive

Nested directive within ngView does not work Angular JS

纵然是瞬间 提交于 2019-12-12 01:23:12
问题 I'm having exact problem as this stackoverflow question. Nested directive does not work with ngview and routeconfig. But my problem is not related to syntax. I have defined modules as below: angular.module('hiDashboard', []); angular.module('hiFramework', ['hiDashboard']); angular.module('app', ['hiFramework']); Config code: angular.module('app').config(function ($routeProvider) { var routes = [ { url: '/dashboard', config: { template: '<wwa-dashboard></wwa-dashboard>' } }, { url: '/friends',

breezejs createEntity is undefined

与世无争的帅哥 提交于 2019-12-12 01:01:33
问题 Inside an AngularJS directive, I assign a new value to a scope variable: $scope.myPerson = { TiersId: 105191, Name: "John Smith" }; Originaly the $scope.myPerson was created from a BreezeJS entity. Assigning the new value triggers a $scope.apply() by AngularJS, which is then intercepted by BreezeJS. That's when it gets complicated. [EDIT] Ok, I've figured out that I need to use the EntityManager that I've registered with my dataContext: $scope.myPerson = myDataContext.createPerson({ TiersId:

How to stop an Multiple SetInterval in Angular based Application

走远了吗. 提交于 2019-12-12 00:37:51
问题 myApp.run(function ($rootScope, $interval, $timeout, $state, $localStorage) { load = function () { cdreset(); // reset the countdown to 0 countdown(); // call the countdown function $rootScope.stayLogin = function () { cdreset(); // reset the countdown to 0 alert("Proceed functioncall"); window.NewTimerCalC = function () { alert('trisssssgered'); return false; }; NewTimerCalCProceed(); }; } $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams,

AngularJS: model data from http call not available in directive

£可爱£侵袭症+ 提交于 2019-12-12 00:36:42
问题 There seems to be a bug where model data fetched from an http call is present in the $scope but not in a directive. Here is the code that illustrates the problem: Jsfiddle: http://jsfiddle.net/supercobra/hrgpc/ var myApp = angular.module('myApp', []).directive('prettyTag', function($interpolate) { return { restrict: 'E', link: function(scope, element, attrs) { var text = element.text(); //var text = attrs.ngModel; var e = $interpolate(text)(scope); var htmlText = "<b>" + e + "</b>"; element

how to fire a controller method from another controller or directive?

女生的网名这么多〃 提交于 2019-12-11 23:56:13
问题 What I need is to show some values automatically when I process some data on another controller, but how can I fire my $scope.setOnController1 function on controller1 when the controller2 have ended to process my data automatically. JS FIDDLE http://jsfiddle.net/b2fCE/228/ Here is HTML the code <div ng-app="myApp"> <div ng-controller="myController1"> <button ng-click="setOnController1()">Force values(SECOND)</button><br/> <ul> <li><b>myController1</b> (values won't change)</li> <li>{

Load json data into the factory file

旧街凉风 提交于 2019-12-11 23:33:53
问题 I am new to AngularJS and just started learning it. How can I load the JSON file into the script.js file without directly adding the entire data. Here is the code of the program: <!DOCTYPE html> <html ng-app="quizApp"> <head> <meta charset="utf-8" /> <title>QuizApp</title> <link rel="stylesheet" href="style.css" /> <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script> <script src="script

Directive not rendering after $http request

允我心安 提交于 2019-12-11 23:18:02
问题 I began working with angularjs and have a problem. app.js (just the relevant route) $routeProvider.when('/search', {templateUrl: 'partials/search-results.html', controller: 'SearchController', title: 'Product Search'}); search-results.html <div product-list></div> index.html <div class="page_content_offset p_bottom_0"> <div class="container mh600"> <div ng-view></div> </div> </div> product-list.html <div ng-repeat="item in items"> <p>{{item.address_components[0].long_name}}</p> </div>

AngularJS Enter a Formatted value similar to a filter and remove formatting for processing

喜你入骨 提交于 2019-12-11 23:16:45
问题 I have a filter for showing currency values that extended the default currency filter. Our API will store data in cents, but I want the User Interface to show the price similar to how people are use to working with it (dollars and cents). The filter is straight forward, and works on normal fields, ui.Grid, etc... /** * Currency Filter */ angular.module('myApp').filter('SLS_Currency', function($filter) { var CurrencyFilter = $filter('currency'); return function(Input){ return CurrencyFilter

angular.js Getting the element from inside $evalAsync in directive

。_饼干妹妹 提交于 2019-12-11 23:12:53
问题 I'm finding that I'm using scope.$evalAsync inside a directive quite a lot. Mainly to do DOM stuff/jquery plugins that need all the template {{vars}} compiled. I can get at the scope object from inside $evalAsync but not the element. In latest case in question, I'm manipulating an element that gets rendered with an ngRepeat. I'm currently getting the element by composing a jquery selector based on the scope object e.g. scope.$evalAsync(function (scope) { $("#item-" + scope.id).runJQplugin();

Getting controller model from isolate scope directive

淺唱寂寞╮ 提交于 2019-12-11 22:50:58
问题 I know that there are a billion questions about isolate scope on here, but I could not find one that directly relates to this exact issue. I have a property on my controller called Model , so .. $scope.Model . I then have a directive that needs to interact with the Model. I am wanting to give the directive an isolate scope, but this is proving a bit difficult because doing that means I no longer have access to the model. I thought I could solve this by specifying the model as a two-way