Search Posts

Category: ng-view

Double ng-view/ui-view in AngularJS, is it possible?

I am developing an app with the MEAN stack…and the question is… How can I divide the interface of my app? I have a static page(such a webpage) and an application page, the interface is different but the development that I have followed is… In the file ‘index.js’ of my app, where I put all the dependencies and set the . In this file I have set the header and the footer of the static […]

ngRoute/ng-view not working in angularJs

I have tried google but cannot able to found a solution. Also cross check everything.I have tried many solution but it didn’t solved my problem. Here is my source code. App.js: var app = angular.module(‘myApp’, [‘ngMessages’, ‘ngRoute’]); app.config(function($routeProvider,$locationProvider){ $routeProvider.when(‘/’,{ tempelateUrl:’pages/home.html’ }) .when(‘/second’,{ tempelateUrl:’pages/second.html’ }) $locationProvider.html5Mode({ enabled: true, requireBase: false }); }); HTML file: <!DOCTYPE html> <html lang=”en” ng-app=”myApp”> <head> <meta charset=”utf-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1, shrink-to-fit=no”> <meta name=”description” content=””> <meta name=”author” content=””> <title>Heroic Features – […]

AngularJS: Controller inside ng-view

how to AngularJS: Controller inside ng-view I have problem with controller load when I triggered ng-route. This is my main page: <!DOCTYPE html> <html> <head ng-app=”testapp”> <script type=”text/javascript” src=”angular.js”></script> <script type=”text/javascript” src=”angular-route.js”></script> <script type=”text/javascript” src=”app.js”></script> <title>XX</title> </head> <body> <nav ng-controller=”defaultnav”></nav> <div ng-view></div> </body> </html> and this is my app.js file: var app = angular.module(‘testapp’, [‘ngRoute’]); app.config(function ($routeProvider) { $routeProvider. when(“/”, { templateUrl: “index.html” }) .when(“/page1”, { templateUrl: “page1.html” }) }) inside the page1.html I inisiate […]

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 () { this.name = “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 = datapass.name; $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 […]