on clicking a button I call viewJob function and pass jobId , the response data I am trying to display in bootstrap modal. But I am unable to do it ,the values are assigning as local variable.
Even I tried this in html
{{viewJob(model.citynew)}}
If still you want that as $scope function then try below code:
Controller:
$scope.model = {}
$scope.viewJob = function (jobId) {
UserService.employerJob(jobId).then(function(response) {
if(response.json.response.statuscode == 0) {
$scope.data = response.json.response.data;
$scope.keyskills = $scope.data.keySkill;
$scope.model.citynew = $scope.data.location.city;
$scope.model.numberofpositionsnew = $scope.data.numberOfPositions;
$scope.model.experiencelevelnew = $scope.data.experienceLevel;
$scope.model.link = $scope.data.link;
$('#viewJobModal1').modal('show');
}
});
};
HTML
<div class="modal fade" id="viewJobModal1" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog" role="dialog">
<div class="modal-content" id="style-4" style="height:400px;line-height: 1.8;overflow-y: auto;">
<div class="modal-header" style="background-color:#3e79b6;height:50px;">
<div class="col-sm-4" style="font-size:20px;text-align:center;color:white; width: 94.333333% !important;">View Details of Job</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="color:black;">×</span>
</button>
</div>
<div class="modal-body" style="height: 400px;line-height: 1.8;">
<div class="col-lg-12">
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Company Name :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{(model.companynew)}}</div>
</div>
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Job title :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{model.jobtitlenew}}</div>
</div>
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Job Description :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{model.jobdescriptionnew}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
I don't think you can use {{viewJob(model.citynew)}} because viewJob takes a jobId as parameter.
It's generally recommended to resolve promises as part of the transition when opening a modal, by passing them in the resolves block.
E.g. Calling the modal in your page's controller
$modal.open({
templateUrl: 'path/to/modal/template.html',
controller: 'ModalCtrl',
controllerAs: 'modalCtrl',
resolve: {
job: function () {
return UserService.employerJob(jobId);
}
}
});
Then, in your ModalCtrl, you can grab the job as a dependency display the data however you want in your template
angular.module('AppModule').controller('ModalCtrl', ['job', function (job) {
modalCtrl = this;
modalCtrl.keyskills = job.keySkill;
modalCtrl.citynew = job.location.city;
modalCtrl.numberofpositionsnew = job.numberOfPositions;
modalCtrl.experiencelevelnew = job.experienceLevel;
modalCtrl.companynew = job.company;
modalCtrl.jobtitlenew = job.jobTitle;
modalCtrl.jobdescriptionnew = job.jobDescription;
modalCtrl.link = job.link;
}]);
And then display these in your modal template
<div class="modal fade" id="viewJobModal1" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog" role="dialog">
<div class="modal-content" id="style-4" style="height:400px;line-height: 1.8;overflow-y: auto;">
<div class="modal-header" style="background-color:#3e79b6;height:50px;">
<div class="col-sm-4" style="font-size:20px;text-align:center;color:white; width: 94.333333% !important;">View Details of Job</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="color:black;">×</span>
</button>
</div>
<div class="modal-body" style="height: 400px;line-height: 1.8;">
<div class="col-lg-12">
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Company Name :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{(modalCtrl.companynew)}}</div>
</div>
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Job title :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{modalCtrl.jobtitlenew}}</div>
</div>
<div class="col-lg-12" align="center" style="text-align:justify;">
<div class="col-lg-5"><b>Job Description :</b></div>
<div class="col-lg-7" style="text-align:justify;">{{modalCtrl.jobdescriptionnew}} </div>
</div>
</div>
</div>
</div>
</div>
</div>
Hope that helps :)
Related
I have this modal here
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Details</h4>
</div>
<div class="modal-body">
<div class="row" ng-repeat="prods in products">
<div class="col-sm-4">
<p>#{{prods.pd }}</p>
</div>
<div class="col-sm-4">
<p>#{{ prods.quantity }}</p>
</div>
<div class="col-sm-4">
<p>#{{ prods.totalline }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
I show my model clicking in a button
<button id="btn-add" class="btn btn-primary btn-sm" ng-click="toggle()"> View Details <i class="fa fa-plus" aria-hidden="true" style="margin-left: 50px; margin-right: 20px"></i></button>
And im trying to display some data.
My controller js is like this
app.controller('productDelivedController', function($scope, $http, API_URL) {
$scope.toggle = function() {
$http.get(API_URL + 'donation/listLines/1')
.success(function(response) {
$scope.products = response;
});
$('#myModal').modal('show');
}});
Probably im doing something wrong but i dont know what, im receiving the data correctly like i was supose to but i just cant update my modal with that data.
Please try the modal show code in success function, you are displaying the dialog, before data loaded.
If you show the modal after the data loaded, then the problem will not happed.
app.controller('productDelivedController', function($scope, $http, API_URL) {
$scope.toggle = function() {
$http.get(API_URL + 'donation/listLines/1')
.success(function(response) {
$scope.products = response;
$('#myModal').modal('show');
});
}});
I have list of stories with images , content and title in ng-repeat.
When I click on particular story , I need a bootstrap model to open and values to be displayed . I am doing it by calling a function showStories(); But I couldnt do it . I am getting empty value since its globally declared as
$scope.selectedStoryPreview = "";
$scope.selectedStoryContent = "";
$scope.selectedStoryTitle = "";
Html :
<div class="image" ng-repeat="item in filteredStories track by $index">
<img ng-src="{{item.images}}" style="cursor: pointer;" ng-click="showStories(item)" data-toggle="modal" data-target="#storyPreview">
<button><span>{{item.title}}</span>
</button>
</div>
JS:
$scope.showStories = function(item) {
$scope.selectedStoryPreview = item.images;
$scope.selectedStoryContent = item.content;
$scope.selectedStoryTitle = item.title;
}
Modal :
<div class="modal fade" id="storyPreview" role="dialog" data-keyboard="false" data-backdrop="static" style="padding-top: 8em;">
<div class="modal-dialog">
<div class="modal-content" style="text-align: center;">
<div class="modal-header imagemodalhead">
<h4>{{selectedStoryTitle}}</h4>
<a class="edit" ng-click="openmanageprofile()"><img src="css/images/edit.png">
</a>
</div>
<div class="modal-body" style="background: #eee;">
<div class="row">
<img class="file-imageStory" ng-src="{{selectedStoryPreview}}" />
</div>
<br>
<div class="row">
<div class=" col-sm-12 storyPrv">
<span class="styletheStory">{{selectedStoryContent}}</span>
</div>
</div>
<div class="modal-footer imagefooter">
<button type="button" class="button share" ng-click="closePreview()" style="background-color: #7B7D7D; color: black;">close</button>
</div>
</div>
$scope.model is undefined. Set it as $scope.model = {} This way
you can dynamically add properties to it at compile time.
Moreover, you could use data-toggle="modal"
data-target="#viewdetails" as the action event to point to correct
modal.
Also, no need to pass individual properties as arguments in the
method showStories(item), you could send out complete object and
obtain its properties.
DEMO:
Click on the image to open modal.
function MyCtrl($scope) {
$scope.filteredStories = [{
id: 1,
images: 'sample1.png',
title: "sample1",
content: "content here..."
}, {
id: 2,
images: 'sample2.png',
title: "sample2",
content: "content here..."
}, {
id: 3,
images: 'sample3.png',
title: "sample3",
content: "content here..."
}, {
id: 4,
images: 'sample4.png',
title: "sample4",
content: "content here..."
}]
$scope.showStories = function(item) {
$scope.selectedStoryPreview = item.images;
$scope.selectedStoryContent = item.content;
$scope.selectedStoryTitle = item.title;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<body ng-app ng-controller="MyCtrl">
<div class="image" ng-repeat="item in filteredStories track by $index">
<img ng-src="{{item.images}}" style="cursor: pointer;" ng-click="showStories(item)" data-toggle="modal" data-target="#storypreview">
<button><span>{{item.title}}</span>
</button>
</div>
<div class="modal fade" id="storypreview" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="text-align: center;">
<div class="modal-header imagemodalhead">
<h4>{{selectedStoryTitle}}</h4>
<a class="edit" ng-click="openmanageprofile()"><img src="css/images/edit.png">
</a>
</div>
<div class="modal-body" style="background: #eee;">
<div class="row">
<img class="file-imageStory" ng-src="{{selectedStoryPreview}}" />
</div>
<br>
<div class="row">
<div class=" col-sm-12 storyPrv">
<span class="styletheStory">{{selectedStoryContent}}</span>
</div>
</div>
<div class="modal-footer imagefooter">
<button type="button" class="button share" ng-click="closePreview()" style="background-color: #7B7D7D; color: black;" data-dismiss="modal">close</button>
</div>
</div>
</div>
</div>
</div>
</body>
If modal controller is different. Then send the value using resolve method. If the controller is same. Then I think it should display the values.
And provide the id of modal here :
<div class="modal-content" id="storyPreview" style="text-align: center;">
I have a problem with the repository list in the list of all Conributors for this repository.
I want to create a Contributors list in the list of repositories downloaded using GitHub Api. However, I can not get these data for each repository and put them in html.
Has anyone any idea how to do this?
Thank you in advance for your help
My code:
App in html
<div ng-controller="gitApi" ng-app="app">
<div class="container">
<h1 class="text-center">
<span ng-hide="userData" />Loading</span>
<span />{{userData.name}}</span>
<br>
<a href="{{userData.html_url}}" class="btn btn-default">
{{userData.login}}
</a>
</h1>
<div class="panel panel-default">
<div class="panel-heading">
<form class="form-inline">
<span>
<h4>Repos <span class="badge">{{repoData.length}}</span>
<input ng-model="searchText" placeholder="Search" class="form-control input-sm">
</h4>
</span>
</form>
</div>
<div class="panel-body">
<div class="list-group">
<div ng-repeat="orgs in orgsData | filter:searchText | orderBy:predicate:reverse" class="list-group-item ">
<div class="row">
<div class="col-md-6">
<h4>
<a href="{{repo.html_url}}" target="_blank">
{{orgs.name}}
</a>
<small>{{orgs.description}}</small>
</h4>
<small>
<a href="{{orgs.homepage}}" class="">
<i class="fa fa-link"></i> WebPage
</a>
</small>
</div>
<div class="col-md-6">
Conributors List:
<div ng-repeat=" | filter:searchText | orderBy:predicate:reverse" class="list-group-item ">
<div class="row">
<div class="col-md-12">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
APP.js
angular.module('app', [])
.controller('gitApi', ['$scope', '$http', function($scope, $http) {
$scope.reposLoaded = false;
$scope.userLoaded = false;
$scope.orgsLoaded = false;
$http.get("https://api.github.com/users/angular")
.success(function(data) {
$scope.userData = data;
loadOrgsRepos();
});
var loadOrgsRepos = function() {
$http.get("https://api.github.com/orgs/angular/repos")
.success(function(data) {
$scope.orgsData = data;
});
}
$scope.predicate = '-updated_at';
}]);
You can get all contributors url from contributors_url and make an API call for each one of these, storing the result in the original $scope.orgsData array :
"use strict";
var githubApp = angular.module('app', []);
githubApp.controller('gitApi', ['$scope', '$http', '$q', function($scope, $http, $q) {
$http.get("https://api.github.com/users/angular")
.success(function(data) {
$scope.userData = data;
loadOrgsRepos();
});
var loadOrgsRepos = function() {
$http.get("https://api.github.com/orgs/angular/repos")
.success(function(data) {
$scope.orgsData = data;
var contribs = [];
for (var i in data) {
contribs.push(data[i].contributors_url);
}
$q.all(contribs.map(function(item) {
return $http({
method: 'GET',
url: item
});
}))
.then(function(results) {
results.forEach(function(val, i) {
$scope.orgsData[i].contributors = val.data;
});
});
});
}
$scope.repo_sort = '-updated_at';
$scope.contrib_sort = '-contributions'
}]);
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body id="page-top" class="index">
<div ng-controller="gitApi" ng-app="app">
<div class="container">
<h1 class="text-center">
<span ng-hide="userData">Loading</span>
<span>{{userData.name}}</span>
<br>
<a href="{{userData.html_url}}" class="btn btn-default">
{{userData.login}}
</a>
</h1>
<div class="panel panel-default">
<div class="panel-heading">
<form class="form-inline">
<span>
<h4>Repos <span class="badge">{{repoData.length}}</span>
<input ng-model="searchText" placeholder="Search" class="form-control input-sm">
</h4>
</span>
</form>
</div>
<div class="panel-body">
<div class="list-group">
<div ng-repeat="orgs in orgsData | filter:searchText | orderBy:repo_sort:reverse" class="list-group-item ">
<div class="row">
<div class="col-md-8">
<h4>
<a href="{{repo.html_url}}" target="_blank">
{{orgs.name}}
</a>
<small>{{orgs.description}}</small>
</h4>
<small>
<a href="{{orgs.homepage}}" class="">
<i class="fa fa-link"></i> WebPage
</a>
</small>
</div>
<div class="col-md-6">
Conributors List:
<div class="list-group-item">
<div class="row">
<div class="col-md-4">
name
</div>
<div class="col-md-4">
avatar
</div>
<div class="col-md-4">
contributions
</div>
</div>
</div>
<div ng-repeat="contrib in orgs.contributors | filter:searchText | orderBy:contrib_sort:reverse" class="list-group-item">
<div class="row">
<div class="col-md-4">
<a href="{{contrib.html_url}}" target="_blank">
{{contrib.login}}
</a>
</div>
<div class="col-md-4">
<img ng-src="{{contrib.avatar_url}}" height="42" width="42" />
</div>
<div class="col-md-4">
<p>
{{contrib.contributions}}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
Here is another fiddle
I'm using a Bootstrap modal to show details of selected items.
I have a snippet of my modal window that i want to make appear.
If i use it as a modal template I have issues with the style.
But if I trigger the modal window as a normal modal, not a ui.bootstrap one, everything works fine. This are my files:
App.js
var app = angular.module('app', ['ui.router', 'ui.bootstrap']);
app.config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){
$urlRouterProvider.otherwise('/');
$stateProvider.state('home', {
url: '/',
templateUrl: 'productos/productos.html'
});
}]);
app.controller('ModalCtrl', function($scope, $uibModal) {
$scope.items = [{
nombre: 'Federico Ribero',
thumb: 'http://placehold.it/369x246',
desc_corta: 'Esto es la decripcion corta de Fede',
descripcion: 'Esto es la descripcion de Fede'
},{
nombre: 'Camila Nosotti',
thumb: 'http://placehold.it/369x246',
desc_corta: 'Esto es la decripcion corta de Cami',
descripcion: 'Esto es la descripcion de Cami'
},{
nombre: 'Juliana Ribero',
thumb: 'http://placehold.it/369x246',
desc_corta: 'Esto es la decripcion corta de Juli',
descripcion: 'Esto es la descripcion de Juli'
}]
$scope.showModal = function(selectedItem) {
var uibModalInstance = $uibModal.open({
templateUrl : 'modalContent.html',
controller : function($scope, $uibModalInstance, $uibModal, item){
$scope.item = item;
},
resolve: {
item: function(){
return selectedItem;
}
} // empty storage
});
uibModalInstance.result.then(function(selectedItem){
$scope.selected = selectedItem;
},function(){
//on cancel button press
console.log("Modal Closed");
});
};
});
View with modal
<!-- ====PROTFOLIO AREA==== -->
<section id="Portfolio" class="protfolio_area section-padding" ng-controller="ModalCtrl">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="work_trigge">
<ul class="trigger mb80 text-center">
<li class="filter active" data-filter="">ALL</li>
<li class="filter" data-filter=".html">HTML</li>
<li class="filter" data-filter=".wordpress">Wordpress</li>
<li class="filter" data-filter=".ui_ux">UI/UX</li>
<li class="filter" data-filter=".print">PRINT</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div ng-repeat="item in items">
<!--First column-->
<div class="col-lg-4 col-md-12 mb-r">
<!--Card-->
<div class="card card-cascade wider">
<!--Card image-->
<div class="view overlay hm-white-slight">
<img ng-src="{{item.thumb}}" class="img-fluid" alt="">
<a>
<div class="mask"></div>
</a>
</div>
<!--/.Card image-->
<!--Card content-->
<div class="card-block text-xs-center">
<!--Category & Title-->
<h5>Shoes</h5>
<h4 class="card-title"><strong><a ng-click="ModalCtrl.showModal(item)">{{item.nombre}}</a></strong></h4>
<!--Description-->
<p class="card-text">{{item.desc_corta}}
</p>
<!--Card footer-->
<div class="card-footer">
<span class="left"><a class="" data-toggle="tooltip" data-placement="top" title="Ver más" ng-click="showModal(item)">Ver más <i class="fa fa-eye"></i></a>
</span>
<span class="right">
<a class="" data-toggle="tooltip" data-placement="top" title="Marcar como favorito"><i class="fa fa-heart"></i></a>
</span>
</div>
</div>
<!--/.Card content-->
</div>
<!--/.Card-->
</div>
<!--/First column-->
</div>
</div>
<div class="row">
<div class="col-xs-12 trigger_bottom">
<a href="#!" class="th_bt btn waves-effect waves-light">View All
<i class="zmdi zmdi-long-arrow-right"></i>
</a>
</div>
</div>
</div>
</section>
<!-- ====END PROTFOLIO AREA==== -->
Modal triggered by javascript with no style problems
<!-- Modal -->
<div class="modal fade ql-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<!--Content-->
<div class="modal-content">
<!--Header-->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Vista completa del artículo</h4>
</div>
<!--Body-->
<div class="modal-body">
MY MODAL CONTENT GOES HERE.......
</div>
<!--Footer-->
<div class="modal-footer">
<a class="btn btn-default">Ask about details</a>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
<!--/.Content-->
</div>
</div>
<!--/Modal-->
<script type="text/javascript">
$("#myModal").modal("show")
</script>
UI Bootstrap Modal.
<script type="text/ng-template" id="modalContent.html">
<!-- Modal -->
<div class="modal-dialog" role="document">
<!--Content-->
<div class="modal-content">
<!--Header-->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Vista completa del artículo</h4>
</div>
<!--Body-->
<div class="modal-body">
MY MODAL CONTENT GOES HERE.......
</div>
<!--Footer-->
<div class="modal-footer">
<a class="btn btn-default">Ask about details</a>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
<!--/.Content-->
</div>
<!--/Modal-->
</script>
I dont know if you note the first line of my original Modal is:
<div class="modal fade ql-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
If i remove that line from ui.bootstrap modal, my modal style have issues.
If i add that line to ui.bootstrap modal, my modal window dont appear.
Just show the shadow behind the "panel appeared" but nothing shows up
I hope you could understand my problem. Thanks a lot.
UPDATE 1
It looks like you need to add your class to the top window template of the modal. Luckily, UI Bootstrap provides the windowTopClass property, that allows you to add your class to it:
var modalInstance = $uibModal.open({
windowTopClass: 'ql-modal',
templateUrl : 'modalContent.html',
controller : function($scope, $uibModalInstance, $uibModal, item){
$scope.item = item;
},
resolve: {
item: function(){
return selectedItem;
}
} // empty storage
});
Also, there is no need to include the modal dialog container, or the content container:
<div class="modal-dialog" role="document">
<div class="modal-content"></div>
</div>
This is already included by default in UI Bootstrap. If you look at the source code for the library, you will see the window template (https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html) already includes this container:
<div class="modal-dialog {{size ? 'modal-' + size : ''}}"><div class="modal-content" uib-modal-transclude></div></div>
Also, if you want to make changes to this window tempalte, UI Bootstrap provides another property windowTemplateUrl where you can provide your own template:
var modalInstance = $uibModal.open({
windowTopClass: 'ql-modal',
windowTemplateUrl: 'windowTemplate.html',
templateUrl : 'modalContent.html',
controller : function($scope, $uibModalInstance, $uibModal, item){
$scope.item = item;
},
resolve: {
item: function(){
return selectedItem;
}
} // empty storage
});
I'm trying to add a modal popup window to my Angular app. Although it lists down the names, when I click on the names a modal doesn't appear. Below is my code
HTML:
<div ng-app="app">
<div ng-repeat="customer in customers">
<button class="btn btn-default" ng-click="open(customer)">{{ customer.name }}</button> <br />
<!--MODAL WINDOW-->
<script type="text/ng-template" id="myContent.html">
<div class="modal-header">
<h3>The Customer Name is: {{ customer.name }}</h3>
</div>
<div class="modal-body">
This is where the Customer Details Goes<br />
{{ customer.details }}
</div>
<div class="modal-footer">
</div>
</script>
</div>
</div>
JS:
var app = angular.module('app', ['ngRoute','ui.bootstrap']);
app.config(function($routeProvider) {
$routeProvider.
when('/', {controller:testcontroller, templateUrl:'http://localhost/app/index.php/customer/home'}).
otherwise({redirectTo:'/error'});
});
function test2controller ($scope, $modalInstance, customer) {
$scope.customer = customer;
}
function testcontroller ( $scope, $timeout, $modal, $log) {
$scope.customers = [
{
name: 'Ben',
details: 'Some Details for Ben',
},
{
name: 'Donald',
details: 'Some Donald Details',
},
{
name: 'Micky',
details: 'Some Micky Details',
}
];
$scope.open = function (_customer) {
var modalInstance = $modal.open({
controller: "test2controller",
templateUrl: 'myContent.html',
resolve: {
customer: function()
{
return _customer;
}
}
});
};
}
Can someone let me know what am I doing wrong here?
Controller
$scope.saveFeed = function(feed){
$('#exampleModalCenter').modal('show');
console.log(feed);
}
HTML
<a class="dropdown-item p-3" href="#" ng-click="saveFeed(feed.id)">
<div class="d-flex align-items-top">
<div class="icon font-size-20"><i class="ri-save-line"></i>
</div>
<div class="data ml-2">
<h6>Save Post</h6>
<p class="mb-0">Add this to your saved items</p>
</div>
</div>
</a>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>