Search Posts

Category: ng-view

Libraries not working in ng-view AngularJS

Recently I started making my own application on AngularJS. At the early stages I faced a problem and I haven’t been able to solve it for quite a long time. In my app I use ng-view and angular-route to load different parts from .html files. In most of them I require third-party libraries, like Loading Bar. I add script src in the end of body. The thing is, like with that Loading Bar, if I […]

Replacing View using ng-view in angularjs

When the view change its replace the previous view in ng-view. but its not changing. it showing the template data which is “context”. var app = angular.module(“myapp”, [“ngRoute”]); app.service(‘datapass’, function () { = “name”; }); app.config(function ($routeProvider) { $routeProvider .when(“/name”, { template: ‘Context’, controller: ‘front_controller’ }) .when(“/detail”, { template: ‘My Name is Awais Saleem’, controller: ‘main_controller’ }) .otherwise(“/name”); }); app.controller(“front_controller”, function ($scope, datapass,$location) { $scope.url =; $scope.changeView = function () { $scope.url = […]

AngularJS – ui-routing with ng-click not working properly

I’m using ui-router for creating some routes and I’m getting this very weird thing happening. I have this route config .state(‘chapter_route’, { url: ‘/book/:chap’, templateUrl: “views/chapter.html”, params: { chap: null} }) So when I clink on: <a ui-sref=”chapter_route({ chap: getChapter.title})”>CHAPTER:</a> It redirects me, as I wanted, to this following ui-view: <div class=”panel panel-default”> <div class=”panel-body”> <p>{{getChapter.title}}</p> {{getChapter.content}} </div> </div> …… …… <div class=”panel panel-default” data-ng-repeat=”cha in allChapters”> <div class=”panel-body”> <a ui-sref=”chapter_route({ chap: cha.title})” ng-click=”changeChapter(chap)”>{{cha.title}}</a> {{cha.content […]